[systemd-commits] 2 commits - TODO src/cgtop src/systemd

Lennart Poettering lennart at kemper.freedesktop.org
Mon Apr 8 06:24:29 PDT 2013


 TODO                 |    3 +++
 src/cgtop/cgtop.c    |   28 ++++++++++++++--------------
 src/systemd/sd-bus.h |    2 ++
 3 files changed, 19 insertions(+), 14 deletions(-)

New commits:
commit b6b7d4337976eeac610b9ed2c3e1fd596a247b14
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Apr 8 15:23:43 2013 +0200

    update TODO

diff --git a/TODO b/TODO
index 55342bc..93dfc8f 100644
--- a/TODO
+++ b/TODO
@@ -46,6 +46,9 @@ Fedora 19:
 
 Features:
 
+* systemd-delta needs to be made aware of *.d/*.conf drop-in files for
+  units.
+
 * seems that when we follow symlinks to units we prefer the symlink
   destination path over /etc and /usr. We shouldn't do that. Instead
   /etc should always override /run+/usr and also any symlink
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index 5dcc501..45b264a 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -33,6 +33,8 @@ extern "C" {
 #endif
 
 /* TODO:
+ * - rewrite message_read_ap() and message_append_ap() to be non-recursive.
+ *
  * - add page donation logic
  * - api for appending/reading fixed arrays
  * - merge busctl into systemctl or so?

commit 62b95b8b402c0436908cadd7f049a2d0dc677ecc
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Apr 8 15:23:12 2013 +0200

    cgtop: print absolute CPU times with format_timespan

diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 1c05e60..1e21b00 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -446,7 +446,7 @@ static int display(Hashmap *a) {
         Group **array;
         signed path_columns;
         unsigned rows, n = 0, j, maxtcpu = 0, maxtpath = 0;
-        char cpu_title[21];
+        char buffer[MAX3(21, FORMAT_BYTES_MAX, FORMAT_TIMESPAN_MAX)];
 
         assert(a);
 
@@ -466,24 +466,25 @@ static int display(Hashmap *a) {
         /* Find the longest names in one run */
         for (j = 0; j < n; j++) {
                 unsigned cputlen, pathtlen;
-                snprintf(cpu_title, sizeof(cpu_title), "%"PRIu64, array[j]->cpu_usage);
-                cputlen = strlen(cpu_title);
+
+                format_timespan(buffer, sizeof(buffer), (nsec_t) (array[j]->cpu_usage / NSEC_PER_USEC), 0);
+                cputlen = strlen(buffer);
                 maxtcpu = MAX(maxtcpu, cputlen);
                 pathtlen = strlen(array[j]->path);
                 maxtpath = MAX(maxtpath, pathtlen);
         }
 
         if (arg_cpu_type == CPU_PERCENT)
-                snprintf(cpu_title, sizeof(cpu_title), "%6s", "%CPU");
+                snprintf(buffer, sizeof(buffer), "%6s", "%CPU");
         else
-                snprintf(cpu_title, sizeof(cpu_title), "%*s", maxtcpu, "CPU Time");
+                snprintf(buffer, sizeof(buffer), "%*s", maxtcpu, "CPU Time");
 
         rows = lines();
         if (rows <= 10)
                 rows = 10;
 
         if (on_tty()) {
-                path_columns = columns() - 36 - strlen(cpu_title);
+                path_columns = columns() - 36 - strlen(buffer);
                 if (path_columns < 10)
                         path_columns = 10;
 
@@ -492,7 +493,7 @@ static int display(Hashmap *a) {
                        arg_order == ORDER_PATH ? OFF : "",
                        arg_order == ORDER_TASKS ? ON : "", "Tasks",
                        arg_order == ORDER_TASKS ? OFF : "",
-                       arg_order == ORDER_CPU ? ON : "", cpu_title,
+                       arg_order == ORDER_CPU ? ON : "", buffer,
                        arg_order == ORDER_CPU ? OFF : "",
                        arg_order == ORDER_MEMORY ? ON : "", "Memory",
                        arg_order == ORDER_MEMORY ? OFF : "",
@@ -505,7 +506,6 @@ static int display(Hashmap *a) {
 
         for (j = 0; j < n; j++) {
                 char *p;
-                char m[FORMAT_BYTES_MAX];
 
                 if (on_tty() && j + 5 > rows)
                         break;
@@ -521,24 +521,24 @@ static int display(Hashmap *a) {
                 else
                         fputs("       -", stdout);
 
-                if (arg_cpu_type == CPU_PERCENT)
+                if (arg_cpu_type == CPU_PERCENT) {
                         if (g->cpu_valid)
                                 printf(" %6.1f", g->cpu_fraction*100);
                         else
                                 fputs("      -", stdout);
-                else
-                        printf(" %*"PRIu64, maxtcpu, g->cpu_usage);
+                } else
+                        printf(" %*s", maxtcpu, format_timespan(buffer, sizeof(buffer), (nsec_t) (g->cpu_usage / NSEC_PER_USEC), 0));
 
                 if (g->memory_valid)
-                        printf(" %8s", format_bytes(m, sizeof(m), g->memory));
+                        printf(" %8s", format_bytes(buffer, sizeof(buffer), g->memory));
                 else
                         fputs("        -", stdout);
 
                 if (g->io_valid) {
                         printf(" %8s",
-                               format_bytes(m, sizeof(m), g->io_input_bps));
+                               format_bytes(buffer, sizeof(buffer), g->io_input_bps));
                         printf(" %8s",
-                               format_bytes(m, sizeof(m), g->io_output_bps));
+                               format_bytes(buffer, sizeof(buffer), g->io_output_bps));
                 } else
                         fputs("        -        -", stdout);
 



More information about the systemd-commits mailing list