Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

figure out what made startup of the connector slow #74

Open
ensonic opened this issue Feb 10, 2020 · 2 comments
Open

figure out what made startup of the connector slow #74

ensonic opened this issue Feb 10, 2020 · 2 comments

Comments

@ensonic
Copy link
Contributor

ensonic commented Feb 10, 2020

Prepare:

# stop the connector
sudo systemctl stop openrobertalab
# eventually delete update to simplify measurements
rm -rf /home/robot/.local/lib/python/roberta/

Run

strace -e file -o /tmp/strace.log -ttt /usr/bin/openrobertalab

then download it and analyze:

scp [email protected]:/tmp/strace.log ./
# remove everything after SIGINT
~/bin/plot-timeline-strace.py strace.log -o strace.png

Stats for which syscalls take how much time.

strace -e file -o /tmp/strace.log -c /usr/bin/openrobertalab
cat /tmp/strace.log 
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 59.60    0.051897         200       259         6 open
 40.40    0.035181          37       961       151 stat64
  0.00    0.000000           0         3         1 execve
  0.00    0.000000           0        36        36 access
  0.00    0.000000           0         1         1 mkdir
  0.00    0.000000           0         4         2 readlink
  0.00    0.000000           0         1         1 statfs
  0.00    0.000000           0        13         1 lstat64
  0.00    0.000000           0         2         2 statfs64
  0.00    0.000000           0        38         2 openat
------ ----------- ----------- --------- --------- ----------------
100.00    0.087078                  1318       203 total

Find the slowest calls

strace -e file -o /tmp/strace.log -r -ttt /usr/bin/openrobertalab

then download it and analyze:

scp [email protected]:/tmp/strace.log ./strace.rel.log
# remove everything after SIGINT
sort -n strace.rel.log

To see all the files accessed sorted by path:

grep "open(" strace.rel.log | sed 's/open(/open (/' | sort -k 3
@ensonic
Copy link
Contributor Author

ensonic commented Feb 10, 2020

The python path has these components:

  1. /home/robot/.local/lib/python
  2. /usr/bin
  3. /usr/lib/python3.4
  4. /usr/lib/python3.4/plat-arm-linux-gnueabi
  5. /usr/lib/python3.4/lib-dynload
  6. /usr/local/lib/python3.4/dist-packages
  7. /usr/lib/python3/dist-packages

"/usr/local/lib/python3.4" is empyt and we can maybe drop it from the path.

@ensonic
Copy link
Contributor Author

ensonic commented Feb 15, 2020

We can use convert to turn pbm files into png files since those are loaded first:
https://github.com/python-pillow/Pillow/blob/master/src/PIL/ImageFont.py#L74
but pngs load slower than pbm files so this isn't worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant