Timeline for Retrieve CPU usage and memory usage of a single process on Linux?
Current License: CC BY-SA 4.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 24, 2023 at 5:10 | comment | added | SillyBear |
You can fix the stopping issues (Ctrl+C and program exit) by changing your while loop condition from just 'true' to test -d /proc/"$pid"/, this way the loop will exit when your program ends.
|
|
| Aug 4, 2023 at 21:11 | comment | added | pglpm | Happened to me too a couple of times, noticing it last minute :) I'm sure no reader got stuck in an infinite referential loop :D Thank you for the excellent informative answer by the way! (I mean the answer to the OP) | |
| Aug 4, 2023 at 18:04 | comment | added | Ciro Santilli OurBigBook.com | @pglpm it's because I sometimes copy answers across sites and forget to update related section. But at least it is true nonetheless given the reflexivity of relatedness. | |
| Aug 4, 2023 at 16:51 | comment | added | pglpm | Somewhat funny: the "Retrieve CPU..." link at the end is to this very question :) | |
| Aug 24, 2022 at 10:10 | comment | added | alper |
Ah I was in zsh that's why I was not able to make it work
|
|
| Aug 24, 2022 at 10:03 | comment | added | Ciro Santilli OurBigBook.com |
@alper yes. Tested on Ubuntu 22.04 now with toppp stress-ng --vm 8 --vm-bytes 80% -t 5. What's your error?
|
|
| Aug 24, 2022 at 9:56 | comment | added | alper | Is it a bash function? I was not able to make it work | |
| Aug 24, 2022 at 9:52 | comment | added | Ciro Santilli OurBigBook.com |
@alper toppp is a different command than topp ;-) The naming convention is glorious I must say.
|
|
| Aug 24, 2022 at 9:29 | comment | added | alper |
shoudn't it be topp() { .. }
|
|
| Apr 26, 2022 at 15:46 | history | edited | Ciro Santilli OurBigBook.com | CC BY-SA 4.0 |
added 4 characters in body
|
| Apr 26, 2022 at 9:18 | history | edited | Ciro Santilli OurBigBook.com | CC BY-SA 4.0 |
added 172 characters in body
|
| Apr 26, 2022 at 9:08 | history | edited | Ciro Santilli OurBigBook.com | CC BY-SA 4.0 |
added 3 characters in body
|
| Apr 26, 2022 at 8:38 | history | edited | Ciro Santilli OurBigBook.com | CC BY-SA 4.0 |
added 311 characters in body
|
| Apr 26, 2022 at 8:33 | history | edited | Ciro Santilli OurBigBook.com | CC BY-SA 4.0 |
added 311 characters in body
|
| Apr 25, 2022 at 16:51 | history | edited | Ciro Santilli OurBigBook.com | CC BY-SA 4.0 |
added 2454 characters in body
|
| Apr 25, 2022 at 16:45 | history | edited | Ciro Santilli OurBigBook.com | CC BY-SA 4.0 |
added 2454 characters in body
|
| Apr 25, 2022 at 16:14 | history | edited | Ciro Santilli OurBigBook.com | CC BY-SA 4.0 |
added 454 characters in body
|
| Nov 15, 2018 at 12:57 | history | edited | Ciro Santilli OurBigBook.com | CC BY-SA 4.0 |
added 109 characters in body
|
| Nov 13, 2016 at 16:28 | history | answered | Ciro Santilli OurBigBook.com | CC BY-SA 3.0 |