Change 13686

alan_petersen (alan_petersen)
alan_petersen committed this change into //guest/perforce_software/piper/scripts
Request Review
Download .zip
Some people reported high CPU/RAM usage with the ThumbnailGenerator script, so I made some modifications to it:

1. ImageMagick was leaving around some temporary files after it ran, so now I clean up the TEMP_DIR location after the thumbnail attribute is set. this should prevent the temp directory from filling up.

2. I explicitly call gc.collect() after each call to generateThumbnail(). The thumbnail and hex versions get manipulated in memory in generateThumbnail() and I was relying on garbage collection to clean things up when the variables go out of scope, but gc.collect() is supposed to make it a little more explicit and help with performance, so I figured I could give it a try.

3. Experimenting on my VM, I ran the script and it gobbled up CPU (~70%) when running. I found that setting the nice level made it much less CPU-intense. For example:

    nice -n 19 ./ThumbnailGenerator.py -v -l /tmp/thumb.log -c 351

   When run like this, the CPU usage (reported via top) peaked at about 2%. Coolio!
  • Files 1
  • Comments 0
1 edited 0 added 0 deleted
ThumbnailGenerator.py#2
Loading...
Tip: Use n and p to cycle through the changes.