ps icon indicating copy to clipboard operation
ps copied to clipboard

More ps_handle class methods

Open gaborcsardi opened this issue 5 years ago • 8 comments

  • [x] nice() (get + set)
  • [ ] ionice()
  • [ ] rlimit()
  • [ ] io_counters()
  • [ ] num_ctx_switches()
  • [x] num_fds()
  • [x] num_handles()
  • [ ] threads()
  • [ ] cpu_percent()
  • [x] cpu_affinity()
  • [ ] cpu_num()
  • [x] memory_full_info()
  • [ ] memory_percent()
  • [ ] memory_maps()
  • [x] open_files()
  • [x] connections()
  • [ ] wait()

gaborcsardi avatar Jul 22 '18 07:07 gaborcsardi

+1 for set_cpu_affinity! Just needs taskset on Linux, but dunno about other OSs

mike-lawrence avatar Jun 22 '21 18:06 mike-lawrence

Calling external commands is not great in R, and small Docker containers might not have taskset. But there is an easy API for this on Linux: https://linux.die.net/man/2/sched_getaffinity

There is also API for it on Windows: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getprocessaffinitymask

It seems impossible on macOS, though.

gaborcsardi avatar Jun 22 '21 20:06 gaborcsardi

I was just looking for the memory_full_info function. I understand it's still in the process of implementation, right?

brianmsm avatar Apr 15 '22 05:04 brianmsm

@brianmsm Well, these are things I might implement in the future, or things I am happy to get help with.

What do you need from memory_full_info()? There is ps_memory_info() with some basic information:

❯ ps::ps_memory_info()
         rss          vms      pfaults      pageins
    81592320 419098476544         5515           42

gaborcsardi avatar Apr 15 '22 07:04 gaborcsardi

Well, following the psutil documentation in python, the memory_full_info() function allows access to uss (Unique Set Size), pss (Proportional Set Size) and swap information. In my case I am very interested in getting the swap memory information used in a particular process.

brianmsm avatar Apr 15 '22 07:04 brianmsm

@brianmsm Happening here: https://github.com/r-lib/ps/pull/122, Linux seems to be working well.

gaborcsardi avatar Apr 15 '22 08:04 gaborcsardi

Great! Thank you very much, I'll be waiting for you to join the main branch :D

brianmsm avatar Apr 15 '22 21:04 brianmsm

CPU affinity happening here, FYI: https://github.com/r-lib/ps/pull/123

gaborcsardi avatar Apr 22 '22 12:04 gaborcsardi