Permalink
Browse files

Display CPU usage in passenger-status.

  • Loading branch information...
1 parent 033d725 commit 259b89fd0be87bce9b9ac54e0ce3894a2739f7a1 @FooBarWidget FooBarWidget committed May 8, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 ext/common/ApplicationPool2/Pool.h
@@ -434,17 +434,20 @@ class Pool: public enable_shared_from_this<Pool> {
for (p_it = processes.begin(); p_it != processes.end(); p_it++) {
const ProcessPtr &process = *p_it;
char buf[128];
+ char cpubuf[10];
char membuf[10];
+ snprintf(cpubuf, sizeof(cpubuf), "%d%%", (int) process->metrics.cpu);
snprintf(membuf, sizeof(membuf), "%ldM",
(unsigned long) (process->metrics.realMemory() / 1024));
snprintf(buf, sizeof(buf),
- " * PID : %-5lu Sessions : %-2u Processed: %-5u Uptime: %s\n"
- " Memory: %-5s Last used: %s ago",
+ " * PID: %-5lu Sessions: %-2u Processed: %-5u Uptime: %s\n"
+ " CPU: %-5s Memory : %-5s Last used: %s ago",
(unsigned long) process->pid,
process->sessions,
process->processed,
process->uptime().c_str(),
+ cpubuf,
membuf,
distanceOfTimeInWords(process->lastUsed / 1000000).c_str());
result << buf << endl;

0 comments on commit 259b89f

Please sign in to comment.