[Piglit] [PATCH] core: show progress percentage indicator
Ilia Mirkin
imirkin at alum.mit.edu
Tue Jan 28 10:39:59 PST 2014
On Tue, Jan 28, 2014 at 12:27 PM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> Sorry I missed this.
>
> I have a patch out to do something similar
> (http://patchwork.freedesktop.org/patch/17632/), although I was going for
> completely replace rather than enhance. The problem with adding to the logger
> function is that it is already slowing down piglit runs, with my simpler
> output I saw almost a 1 minute improvement in quick.py runtime consistently,
> and I could repeat it over and over. I have a few more comments below.
Your change looks nice actually (assuming it works as advertised). I
had wanted to do a N/total thing instead of a percentage, but that
wouldn't fit well with the old output and make it all jagged, whereas
there had been some apparent effort put in towards padding stuff.
>
> On Wednesday, January 15, 2014 08:45:19 AM Ilia Mirkin wrote:
>> This will show X% instead of 'running' in the status, that way it's
>> easy to see how far along a particular run is.
>>
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>>
>> Written while waiting for a piglit run to complete...
>>
>> framework/core.py | 14 ++++++++++----
>> 1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/framework/core.py b/framework/core.py
>> index 7231938..14b07fb 100644
>> --- a/framework/core.py
>> +++ b/framework/core.py
>> @@ -464,7 +464,7 @@ class Test:
>> def run(self):
>> raise NotImplementedError
>>
>> - def execute(self, env, path, json_writer):
>> + def execute(self, env, run_msg, path, json_writer):
>> '''
>> Run the test.
>>
>> @@ -478,7 +478,7 @@ class Test:
>> # Run the test
>> if env.execute:
>> try:
>> - status("running")
>> + status(run_msg)
>> time_start = time.time()
>> result = self.run(env)
>> time_end = time.time()
>> @@ -508,7 +508,7 @@ class Test:
>> else:
>> json_writer.write_dict_item(path, result)
>> else:
>> - status("dry-run")
>> + status("dry-run %s" % run_msg)
>>
>>
>> class Group(dict):
>> @@ -565,6 +565,9 @@ class TestProfile:
>> '''
>>
>> self.prepare_test_list(env)
>> + total = len(self.test_list)
>> + count = [0]
>> + lock = multiprocessing.dummy.Lock()
>
> I'm actually on a campaign to kill Group, I'm just a little sidetracked in the
> mess of the Test classes right now, but t would be best not to add code to
> Group()
>
>>
>> def test(pair):
>> """ Function to call test.execute from .map
>> @@ -573,7 +576,10 @@ class TestProfile:
>>
>> """
>> name, test = pair
>> - test.execute(env, name, json_writer)
>> + with lock:
>> + count[0] = count[0] + 1
>> + pct = 100. * count[0] / total
>> + test.execute(env, "%.0f%%" % pct, name, json_writer)
>>
>> # Multiprocessing.dummy is a wrapper around Threading that provides
>> a # multiprocessing compatible API
More information about the Piglit
mailing list