This is an archive of the discontinued LLVM Phabricator instance.

[opt-viewer] Add progress indicators (PR33522)
ClosedPublic

Authored by modocache on Jun 27 2017, 8:09 PM.

Details

Summary

Provide feedback to users of opt-diff.py, opt-stats.py, and opt-viewer.py,
on how many YAML files have finished being processed, and how many HTML
files have been generated. This feedback is particularly helpful for
opt-viewer.py, which may take a long time to complete when given many
large YAML files as input.

The progress indicators use simple output such as the following:

Reading YAML files...
    9 of 1197

Test plan:
Run utils/opt-viewer/opt-*.py on a CentOS and macOS machine, using
Python 3.4 and Python 2.7 respectively, and ensure the output is
formatted well on both.

Event Timeline

modocache created this revision.Jun 27 2017, 8:09 PM
anemet edited edge metadata.Jun 29 2017, 9:45 AM

This is great! I am wondering if you looked at actual progressbars. For example looks like that tqdm might not be hard to adapt to multiprocessing (https://stackoverflow.com/a/40133278). What do you think? I am happy to take this as is if you don't want to spend more time on this for now. This is already great "progress" :)

fhahn removed a subscriber: fhahn.Jun 29 2017, 9:46 AM

I had seen tqdm, but:

  1. I wasn't sure what you thought about taking on another dependency, so I erred on the safe side of no additional external dependencies
  2. Just printing "N of 1197" is good enough for me, it lets me get some feedback on whether the script is still working hard or whether it's stuck

Up to you, though! Happy to rewrite this with tqdm. My personal preference would be to merge as-is, and if someone wants to make a nicer-looking progress bar they're free to use tqdm.

I had seen tqdm, but:

  1. I wasn't sure what you thought about taking on another dependency, so I erred on the safe side of no additional external dependencies
  2. Just printing "N of 1197" is good enough for me, it lets me get some feedback on whether the script is still working hard or whether it's stuck

Up to you, though! Happy to rewrite this with tqdm. My personal preference would be to merge as-is, and if someone wants to make a nicer-looking progress bar they're free to use tqdm.

I'd probably err on the side of fewer dependencies also. Within PlayStation we're considering distributing these scripts to end-users (as a stop-gap until something we could possibly do something better with the YAML) so each additional dependency adds some pain.

FWIW I tested the change on Windows also (against Python 2.7.13 only) and it works fine.

Thanks for the work.

Simon

anemet accepted this revision.Jun 29 2017, 10:31 AM

I had seen tqdm, but:

  1. I wasn't sure what you thought about taking on another dependency, so I erred on the safe side of no additional external dependencies

I was hoping we could do it the way the libYAML dependency is handled: use it as an optional library.

  1. Just printing "N of 1197" is good enough for me, it lets me get some feedback on whether the script is still working hard or whether it's stuck

Up to you, though! Happy to rewrite this with tqdm. My personal preference would be to merge as-is, and if someone wants to make a nicer-looking progress bar they're free to use tqdm.

I am cool with that. LGTM then ;).

This revision is now accepted and ready to land.Jun 29 2017, 10:31 AM

_Very_ minor tweak for macOS: add an extra carriage return after all processing is done. I'll land this now, thanks for the reviews, and for checking on Windows!

modocache closed this revision.Jun 29 2017, 11:56 AM