astrofrog / psrecord

Record the CPU and memory activity of a process :chart_with_upwards_trend:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work for a root process (Reply please, Urgent)

ghostSystem opened this issue · comments

Can you confirm how to get CPU% for a root process.

I am getting the following error while running a root process

vmware$ psrecord 486 --interval 1 --duration 60 --plot /Users/vmware/Desktop/sample.png
Attaching to process 486

Traceback (most recent call last):
File "/Users/vmware/anaconda3/bin/psrecord", line 7, in
sys.exit(psrecord.main())
File "/Users/vmware/anaconda3/lib/python3.6/site-packages/psrecord/main.py", line 109, in main
interval=args.interval, include_children=args.include_children)
File "/Users/vmware/anaconda3/lib/python3.6/site-packages/psrecord/main.py", line 218, in monitor
ax.set_ylim(0., max(log['cpu']) * 1.2)

@ghostSystem - it looks like there are some lines missing in the exception - could you include them?

Does the error happen after 60 seconds or immediately?

@astrofrog this is the complete error that I got. The error comes immediately.

Last line I missed for the error:

ValueError: max() arg is an empty sequence

If I try to log the output then it just stops(says attaching to process and immediately exits). In case I try to plot it, it gives me the above mentioned error.

@ghostSystem - I think running with sudo should help:

sudo psrecord 486 --interval 1 --duration 60 --plot /Users/vmware/Desktop/sample.png

@astrofrog sudo worked.
Thanks a lot. You just made my day :)

One query, do I need sudo every time to run a root process or is there a way around it ?

@ghostSystem - I don't think there is any way around it, sorry!

Hi,
I got the same error, but using sudo does not make things right.

Traceback (most recent call last):
file "./psrecord", line 7, in
sys.exit(psrecord.main())
File "/home/ben/.local/lib/python2.7/site-packages/psrecord/main.py", line 108, in main
interval=args.interval, include_children-args.include_children)
File "/home/ben/.local/lib/python2.7/site-packages/psrecord/main.py", line 221, in monitor
ax.set_ylim(0., max(log['cpu']) * 1.2)
ValueError: max() arg is an empty sequence