aboutsummaryrefslogtreecommitdiff
path: root/process
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2010-09-26 04:42:05 -0700
committerArjan van de Ven <arjan@linux.intel.com>2010-09-26 04:42:05 -0700
commitd82f573ccad7738631e1a0be18dda4e2fae04dd5 (patch)
tree148cd8fb484486b2021b0851307e2ecdb18fe15e /process
parent473bfdf131be5828cbbf5548043ab536dcec7774 (diff)
downloadpowertop-d82f573ccad7738631e1a0be18dda4e2fae04dd5.tar.gz
start showing the first screen with better info
Diffstat (limited to 'process')
-rw-r--r--process/device.cpp2
-rw-r--r--process/device.h1
-rw-r--r--process/do_process.cpp21
-rw-r--r--process/interrupt.cpp4
-rw-r--r--process/interrupt.h1
-rw-r--r--process/powerconsumer.h6
-rw-r--r--process/process.cpp4
-rw-r--r--process/process.h1
-rw-r--r--process/timer.cpp4
-rw-r--r--process/timer.h1
-rw-r--r--process/work.cpp4
-rw-r--r--process/work.h1
12 files changed, 35 insertions, 15 deletions
diff --git a/process/device.cpp b/process/device.cpp
index 0e4407d..6de1c06 100644
--- a/process/device.cpp
+++ b/process/device.cpp
@@ -11,7 +11,7 @@ device_consumer::device_consumer(class device *dev)
const char * device_consumer::description(void)
{
- sprintf(str, "Device (%s) %s", device->class_name(), device->human_name());
+ sprintf(str, "%s", device->human_name());
return str;
}
diff --git a/process/device.h b/process/device.h
index b1ff0ea..2442cbf 100644
--- a/process/device.h
+++ b/process/device.h
@@ -15,6 +15,7 @@ public:
virtual const char * description(void);
virtual const char * name(void) { return "device"; };
+ virtual const char * type(void) { return "Device"; };
virtual double Witts(void);
};
diff --git a/process/do_process.cpp b/process/do_process.cpp
index 73d7ec7..7a4d74f 100644
--- a/process/do_process.cpp
+++ b/process/do_process.cpp
@@ -453,6 +453,8 @@ void process_update_display(void)
unsigned int i;
WINDOW *win;
+ sort(all_power.begin(), all_power.end(), power_cpu_sort);
+
win = tab_windows["Overview"];
if (!win)
return;
@@ -461,8 +463,23 @@ void process_update_display(void)
wmove(win, 2,0);
- for (i = 0; i < all_power.size(); i++)
- wprintw(win, "%6.1fmW %s\n", all_power[i]->Witts()*1000, all_power[i]->description());
+ wprintw(win, "Power est. Usage/s Events/s Category Description\n");
+
+ for (i = 0; i < all_power.size(); i++) {
+ char power[16];
+ char name[20];
+ char usage[20];
+ char events[20];
+ format_watts(all_power[i]->Witts(), power, 10);
+ sprintf(name, all_power[i]->type());
+ while (strlen(name) < 14) strcat(name, " ");
+
+ sprintf(usage, "%5.1f%s", all_power[i]->usage(), all_power[i]->usage_units());
+ while (strlen(usage) < 10) strcat(usage, " ");
+ sprintf(events, "%5.1f", all_power[i]->events());
+ while (strlen(events) < 12) strcat(events, " ");
+ wprintw(win, "%s %s %s %s %s\n", power, usage, events, name, all_power[i]->description());
+ }
}
void process_process_data(void)
diff --git a/process/interrupt.cpp b/process/interrupt.cpp
index ca48011..77cbced 100644
--- a/process/interrupt.cpp
+++ b/process/interrupt.cpp
@@ -50,9 +50,7 @@ const char * interrupt::description(void)
{
if (child_runtime > accumulated_runtime)
child_runtime = 0;
- sprintf(desc, "Interrupt (%2i) %15s time %5.2fms wakeups %4.1f (child %5.1fms) (total: %i) ", number,
- handler, (accumulated_runtime - child_runtime) / 1000000.0 / measurement_time / measurement_time, wake_ups / measurement_time,
- child_runtime / 1000000.0, raw_count);
+ sprintf(desc, "[%i] %s", number, handler);
return desc;
}
diff --git a/process/interrupt.h b/process/interrupt.h
index ea83b3c..49a3e2c 100644
--- a/process/interrupt.h
+++ b/process/interrupt.h
@@ -22,6 +22,7 @@ public:
virtual const char * description(void);
virtual const char * name(void) { return "interrupt"; };
+ virtual const char * type(void) { return "Interrupt"; };
};
diff --git a/process/powerconsumer.h b/process/powerconsumer.h
index 6e6176f..5a2db8a 100644
--- a/process/powerconsumer.h
+++ b/process/powerconsumer.h
@@ -7,6 +7,7 @@
using namespace std;
+extern double measurement_time;
class power_consumer;
@@ -26,6 +27,11 @@ public:
virtual const char * description(void) { return ""; };
virtual const char * name(void) { return "abstract"; };
+ virtual const char * type(void) { return "abstract"; };
+
+ virtual double usage(void) { return (accumulated_runtime - child_runtime) / 1000000.0 / measurement_time;};
+ virtual const char * usage_units(void) {return "msec";};
+ virtual double events(void) { return (wake_ups + gpu_ops) / measurement_time;};
};
extern vector <class power_consumer *> all_power;
diff --git a/process/process.cpp b/process/process.cpp
index c172b40..f20f29c 100644
--- a/process/process.cpp
+++ b/process/process.cpp
@@ -56,9 +56,7 @@ const char * process::description(void)
if (child_runtime > accumulated_runtime)
child_runtime = 0;
- sprintf(desc, "Process %22s time %5.2fms wakeups %4.1f gpu ops %4.1f (child %5.1fms)",
- comm, (accumulated_runtime - child_runtime) / 1000000.0 / measurement_time, wake_ups / measurement_time,
- gpu_ops / measurement_time, child_runtime / 1000000.0);
+ sprintf(desc, "%s", comm);
return desc;
}
diff --git a/process/process.h b/process/process.h
index fb9e1d6..85da949 100644
--- a/process/process.h
+++ b/process/process.h
@@ -32,6 +32,7 @@ public:
virtual const char * description(void);
virtual const char * name(void) { return "process"; };
+ virtual const char * type(void) { return "Process"; };
};
diff --git a/process/timer.cpp b/process/timer.cpp
index 551d865..474bb97 100644
--- a/process/timer.cpp
+++ b/process/timer.cpp
@@ -63,9 +63,7 @@ const char * timer::description(void)
if (child_runtime > accumulated_runtime)
child_runtime = 0;
- sprintf(desc, "Timer %23s time %5.2fms wakeups %4.1f (total: %i)",
- handler, (accumulated_runtime - child_runtime) / 1000000.0 / measurement_time,
- wake_ups / measurement_time, raw_count);
+ sprintf(desc, "%s", handler);
return desc;
}
diff --git a/process/timer.h b/process/timer.h
index 4d18668..3391546 100644
--- a/process/timer.h
+++ b/process/timer.h
@@ -18,6 +18,7 @@ public:
virtual const char * description(void);
virtual const char * name(void) { return "timer"; };
+ virtual const char * type(void) { return "Timer"; };
};
diff --git a/process/work.cpp b/process/work.cpp
index 9747b41..8e31e78 100644
--- a/process/work.cpp
+++ b/process/work.cpp
@@ -63,9 +63,7 @@ const char * work::description(void)
if (child_runtime > accumulated_runtime)
child_runtime = 0;
- sprintf(desc, "Work %24s time %5.2fms wakeups %4.1f (total: %i)",
- handler, (accumulated_runtime - child_runtime) / 1000000.0 / measurement_time,
- wake_ups / measurement_time, raw_count);
+ sprintf(desc, "%s", handler);
return desc;
}
diff --git a/process/work.h b/process/work.h
index 4dc88f2..9088440 100644
--- a/process/work.h
+++ b/process/work.h
@@ -18,6 +18,7 @@ public:
virtual const char * description(void);
virtual const char * name(void) { return "work"; };
+ virtual const char * type(void) { return "kWork"; };
};