diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2010-11-28 21:11:36 -0800 |
---|---|---|
committer | Arjan van de Ven <arjan@linux.intel.com> | 2010-11-28 21:11:36 -0800 |
commit | 1aa80f9e2b69cc9ffaa7e2728fdfbc566ee46a02 (patch) | |
tree | b276817bf1236aea06b4cb1c99ba22376423610c | |
parent | ba7650000999f2340a57c6a29622db72c1aeebac (diff) | |
parent | dcce2ed2964d79b66790e8a436e4c777c0dfbb64 (diff) | |
download | powertop-1aa80f9e2b69cc9ffaa7e2728fdfbc566ee46a02.tar.gz |
Merge branch 'master' of master.kernel.org:/pub/scm/status/powertop/powertop
-rw-r--r-- | display.h | 2 | ||||
-rw-r--r-- | process/process.cpp | 32 | ||||
-rw-r--r-- | process/process.h | 3 | ||||
-rw-r--r-- | tuning/tuning.cpp | 3 |
4 files changed, 36 insertions, 4 deletions
@@ -54,7 +54,7 @@ public: virtual void cursor_enter(void) { }; virtual void repaint(void) { }; - virtual void expose(void) { }; + virtual void expose(void) { cursor_pos = 0; repaint();}; virtual void hide(void) { }; }; diff --git a/process/process.cpp b/process/process.cpp index 73d9d39..5e19b0b 100644 --- a/process/process.cpp +++ b/process/process.cpp @@ -71,7 +71,7 @@ uint64_t process::deschedule_thread(uint64_t time, int thread_id) } -process::process(const char *_comm, int _pid) : power_consumer() +process::process(const char *_comm, int _pid, int _tid) : power_consumer() { char line[4096]; ifstream file; @@ -83,6 +83,25 @@ process::process(const char *_comm, int _pid) : power_consumer() last_waker = NULL; waker = NULL; is_kernel = 0; + tgid = _tid; + + if (_tid == 0) { + sprintf(line, "/proc/%i/status", _pid); + file.open(line); + while (file) { + file.getline(line, 4096); + if (strstr(line, "Tgid")) { + char *c; + c = strchr(line, ':'); + if (!c) + continue; + c++; + tgid = strtoull(c, NULL, 10); + break; + } + } + file.close(); + } if (strncmp(_comm, "kondemand/", 10) == 0) is_idle = 1; @@ -148,6 +167,17 @@ void merge_processes(void) { unsigned int i,j; class process *one, *two; + + /* fold threads */ + for (i = 0; i < all_processes.size() ; i++) { + one = all_processes[i]; + for (j = i + 1; j < all_processes.size(); j++) { + two = all_processes[j]; + if (one->pid == two->tgid && two->tgid != 0) + merge_process(one, two); + } + } + /* find dupes and add up */ for (i = 0; i < all_processes.size() ; i++) { one = all_processes[i]; diff --git a/process/process.h b/process/process.h index cb748f9..8371c3f 100644 --- a/process/process.h +++ b/process/process.h @@ -43,6 +43,7 @@ class process : public power_consumer { uint64_t running_since; char desc[256]; public: + int tgid; char comm[16]; int pid; @@ -51,7 +52,7 @@ public: int running; int is_kernel; /* kernel thread */ - process(const char *_comm, int _pid); + process(const char *_comm, int _pid, int _tid = 0); virtual void schedule_thread(uint64_t time, int thread_id); virtual uint64_t deschedule_thread(uint64_t time, int thread_id = 0); diff --git a/tuning/tuning.cpp b/tuning/tuning.cpp index e040117..e31b96e 100644 --- a/tuning/tuning.cpp +++ b/tuning/tuning.cpp @@ -158,6 +158,7 @@ static void sort_tunables(void) void tuning_window::expose(void) { + cursor_pos = 0; sort_tunables(); - repaint(); + repaint(); } |