Advertisement
METAJIJI

psutils

Mar 25th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.05 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4.  
  5. from psutil import Process
  6. # sudo apt-get install python-psutil
  7.  
  8. p = Process(pid=2622)
  9. print p.as_dict(attrs=['pid', 'name', 'cmdline', 'parent', 'getcwd', 'exe', 'terminal', 'username', 'status'])
  10. #print dir(p)
  11.  
  12. #{'username': 'metall', 'status': 'sleeping', 'exe': '/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java', 'name': 'java', 'pid': 2622, 'terminal': None, 'cmdline': ['/usr/lib/jvm/java-7-openjdk-amd64/bin/java', '-Xms128m', '-Xmx750m', '-XX:MaxPermSize=350m', '-XX:ReservedCodeCacheSize=225m', '-ea', '-Dsun.io.useCanonCaches=false', '-Djava.net.preferIPv4Stack=true', '-Djsse.enableSNIExtension=false', '-XX:+UseConcMarkSweepGC', '-XX:SoftRefLRUPolicyMSPerMB=50', '-Dawt.useSystemAAFontSettings=lcd', '-Djb.vmOptionsFile=/home/metall/Programms/PyCharm/bin/pycharm64.vmoptions', '-XX:ErrorFile=/home/metall/java_error_in_PYCHARM_%p.log', '-Xbootclasspath/a:/home/metall/Programms/PyCharm/bin/../lib/boot.jar', '-Didea.paths.selector=PyCharm40', '-Didea.platform.prefix=Python', '-Didea.no.jre.check=true', '-Djb.restart.code=88', 'com.intellij.idea.Main'], 'cwd': '/home/metall'}
  13. #['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_gone', '_last_proc_cpu_times', '_last_sys_cpu_times', '_pid', '_platform_impl', '_ppid', 'as_dict', 'cmdline', 'create_time', 'exe', 'get_children', 'get_connections', 'get_cpu_affinity', 'get_cpu_percent', 'get_cpu_times', 'get_ext_memory_info', 'get_io_counters', 'get_ionice', 'get_memory_info', 'get_memory_maps', 'get_memory_percent', 'get_nice', 'get_num_ctx_switches', 'get_num_fds', 'get_num_threads', 'get_open_files', 'get_rlimit', 'get_threads', 'getcwd', 'gids', 'is_running', 'kill', 'name', 'nice', 'parent', 'pid', 'ppid', 'resume', 'send_signal', 'set_cpu_affinity', 'set_ionice', 'set_nice', 'set_rlimit', 'status', 'suspend', 'terminal', 'terminate', 'uids', 'username', 'wait']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement