Instantly share code, notes, and snippets.

Embed
What would you like to do?
I have a need, a need for snap - snap performance testing tools and scripts

I have a need, a need for snap

The following list includes all the tools and scripts used here:
https://snapcraft.io/blog/i-have-a-need,-a-need-for-snap

VLC 10-loop scripts

#!/bin/bash
for i in `seq 1 10`;
do
        /usr/bin/vlc --play-and-exit video.webm
        sleep 2
done    
exit 0
#!/bin/bash
for i in `seq 1 10`;
do
        /usr/bin/snap run vlc --play-and-exit video.webm
        sleep 2
done    
exit 0

VLC dstat command

/usr/bin/dstat --output file.csv -a 1 200 (for the short video clip)
/usr/bin/dstat --output file.csv -a 1 600 (for the long video clip)

VLC single run timing command

/usr/bin/time -v /usr/bin/vlc --play-and-exit video.webm
/usr/bin/time -v /usr/bin/snap run vlc --play-and-exit video.webm

VLC perf command

/usr/bin/perf record /usr/bin/vlc-wrapper --play-and-exit video.webm
/usr/bin/perf report

GIMP 10-loop scripts

#!/bin/bash
for i in `seq 1 10`;
do
    /bin/cp template.jpg file.jpg
    sync
    sleep 1
        /usr/bin/gimp -i -b '(simple-unsharp-mask "file.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'
        sleep 1
done    
exit 0
#!/bin/bash
for i in `seq 1 10`;
do
    /bin/cp template.jpg file.jpg
    sync
    sleep 1
        /usr/bin/snap run gimp -i -b '(simple-unsharp-mask "file.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'
        sleep 1
done    
exit 0

GIMP simple-sharpen-mask.scm script

(define (simple-unsharp-mask filename radius amount threshold)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(plug-in-unsharp-mask RUN-NONINTERACTIVE image drawable radius amount threshold)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))

The script needs to be placed under:

  • Repository package: ./.gimp-2.8/scripts/
  • Snap package: ~/snap/gimp/current/.config/GIMP/2.10/scripts/

GIMP single run timing command

/usr/bin/time -v /usr/bin/gimp -i -b '(simple-unsharp-mask "file.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'
/usr/bin/time -v /usr/bin/snap run gimp -i -b '(simple-unsharp-mask "file.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'

GIMP perf command

/usr/bin/perf record /usr/bin/gimp -i -b '(simple-unsharp-mask "file.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'
/usr/bin/perf record /usr/bin/snap run gimp -i -b '(simple-unsharp-mask "file.jpg" 5.0 0.5 0)' -b '(gimp-quit 0)'
/usr/bin/perf report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment