diff options
| author | KAMEZAWA Hiroyuki <[email protected]> | 2012-03-23 22:02:54 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2012-03-23 23:58:42 +0000 |
| commit | bda7bad62bc4c4e0783348e8db51abe094153c56 (patch) | |
| tree | c62650a3da656ba18aebe170df7d554158ae5fc5 /lib/string_helpers.c | |
| parent | procfs: add num_to_str() to speed up /proc/stat (diff) | |
| download | kernel-bda7bad62bc4c4e0783348e8db51abe094153c56.tar.gz kernel-bda7bad62bc4c4e0783348e8db51abe094153c56.zip | |
procfs: speed up /proc/pid/stat, statm
Process accounting applications as top, ps visit some files under
/proc/<pid>. With seq_put_decimal_ull(), we can optimize /proc/<pid>/stat
and /proc/<pid>/statm files.
This patch adds
- seq_put_decimal_ll() for signed values.
- allow delimiter == 0.
- convert seq_printf() to seq_put_decimal_ull/ll in /proc/stat, statm.
Test result on a system with 2000+ procs.
Before patch:
[kamezawa@bluextal test]$ top -b -n 1 | wc -l
2223
[kamezawa@bluextal test]$ time top -b -n 1 > /dev/null
real 0m0.675s
user 0m0.044s
sys 0m0.121s
[kamezawa@bluextal test]$ time ps -elf > /dev/null
real 0m0.236s
user 0m0.056s
sys 0m0.176s
After patch:
kamezawa@bluextal ~]$ time top -b -n 1 > /dev/null
real 0m0.657s
user 0m0.052s
sys 0m0.100s
[kamezawa@bluextal ~]$ time ps -elf > /dev/null
real 0m0.198s
user 0m0.050s
sys 0m0.145s
Considering top, ps tend to scan /proc periodically, this will reduce cpu
consumption by top/ps to some extent.
[[email protected]: checkpatch fixes]
Signed-off-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/string_helpers.c')
0 files changed, 0 insertions, 0 deletions
