aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2010-11-28 21:11:36 -0800
committerArjan van de Ven <arjan@linux.intel.com>2010-11-28 21:11:36 -0800
commit1aa80f9e2b69cc9ffaa7e2728fdfbc566ee46a02 (patch)
treeb276817bf1236aea06b4cb1c99ba22376423610c
parentba7650000999f2340a57c6a29622db72c1aeebac (diff)
parentdcce2ed2964d79b66790e8a436e4c777c0dfbb64 (diff)
downloadpowertop-1aa80f9e2b69cc9ffaa7e2728fdfbc566ee46a02.tar.gz
Merge branch 'master' of master.kernel.org:/pub/scm/status/powertop/powertop
-rw-r--r--display.h2
-rw-r--r--process/process.cpp32
-rw-r--r--process/process.h3
-rw-r--r--tuning/tuning.cpp3
4 files changed, 36 insertions, 4 deletions
diff --git a/display.h b/display.h
index 8a8e0a4..c9429ea 100644
--- a/display.h
+++ b/display.h
@@ -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();
}