]> granicus.if.org Git - postgresql/commitdiff
Make getrusage() output a little more readable
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 19 Oct 2016 16:00:00 +0000 (12:00 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 19 Oct 2016 13:53:16 +0000 (09:53 -0400)
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Peter Geoghegan <pg@heroku.com>
doc/src/sgml/ref/vacuum.sgml
src/backend/tcop/postgres.c
src/backend/utils/misc/pg_rusage.c

index dee1c5bad31cb76aff5859a1c2d55e592f32a4de..f18180a2fa29071f6d150ddb840f547f1b31611e 100644 (file)
@@ -253,27 +253,27 @@ INFO:  vacuuming "public.onek"
 INFO:  index "onek_unique1" now contains 1000 tuples in 14 pages
 DETAIL:  3000 index tuples were removed.
 0 index pages have been deleted, 0 are currently reusable.
-CPU 0.01s/0.08u sec elapsed 0.18 sec.
+CPU: user: 0.08 s, system: 0.01 s, elapsed: 0.18 s.
 INFO:  index "onek_unique2" now contains 1000 tuples in 16 pages
 DETAIL:  3000 index tuples were removed.
 0 index pages have been deleted, 0 are currently reusable.
-CPU 0.00s/0.07u sec elapsed 0.23 sec.
+CPU: user: 0.07 s, system: 0.00 s, elapsed: 0.23 s.
 INFO:  index "onek_hundred" now contains 1000 tuples in 13 pages
 DETAIL:  3000 index tuples were removed.
 0 index pages have been deleted, 0 are currently reusable.
-CPU 0.01s/0.08u sec elapsed 0.17 sec.
+CPU: user: 0.08 s, system: 0.01 s, elapsed: 0.17 s.
 INFO:  index "onek_stringu1" now contains 1000 tuples in 48 pages
 DETAIL:  3000 index tuples were removed.
 0 index pages have been deleted, 0 are currently reusable.
-CPU 0.01s/0.09u sec elapsed 0.59 sec.
+CPU: user: 0.09 s, system: 0.01 s, elapsed: 0.59 s.
 INFO:  "onek": removed 3000 tuples in 108 pages
-DETAIL:  CPU 0.01s/0.06u sec elapsed 0.07 sec.
+DETAIL:  CPU: user: 0.06 s, system: 0.01 s, elapsed: 0.07 s.
 INFO:  "onek": found 3000 removable, 1000 nonremovable tuples in 143 pages
 DETAIL:  0 dead tuples cannot be removed yet.
 There were 0 unused item pointers.
 Skipped 0 pages due to buffer pins.
 0 pages are entirely empty.
-CPU 0.07s/0.39u sec elapsed 1.56 sec.
+CPU: user: 0.39 s, system: 0.07 s, elapsed: 1.56 s.
 INFO:  analyzing "public.onek"
 INFO:  "onek": 36 pages, 1000 rows sampled, 1000 estimated total rows
 VACUUM
index 2347f1bcdccd144de2681f60d5e59cdd2f925a9d..599874e7435398573549f3d69f55a102ee6e1114 100644 (file)
@@ -4422,15 +4422,15 @@ ShowUsage(const char *title)
 
        appendStringInfoString(&str, "! system usage stats:\n");
        appendStringInfo(&str,
-                               "!\t%ld.%06ld elapsed %ld.%06ld user %ld.%06ld system sec\n",
-                                        (long) (elapse_t.tv_sec - Save_t.tv_sec),
-                                        (long) (elapse_t.tv_usec - Save_t.tv_usec),
+                               "!\t%ld.%06ld s user, %ld.%06ld s system, %ld.%06ld s elapsed\n",
                                         (long) (r.ru_utime.tv_sec - Save_r.ru_utime.tv_sec),
                                         (long) (r.ru_utime.tv_usec - Save_r.ru_utime.tv_usec),
                                         (long) (r.ru_stime.tv_sec - Save_r.ru_stime.tv_sec),
-                                        (long) (r.ru_stime.tv_usec - Save_r.ru_stime.tv_usec));
+                                        (long) (r.ru_stime.tv_usec - Save_r.ru_stime.tv_usec),
+                                        (long) (elapse_t.tv_sec - Save_t.tv_sec),
+                                        (long) (elapse_t.tv_usec - Save_t.tv_usec));
        appendStringInfo(&str,
-                                        "!\t[%ld.%06ld user %ld.%06ld sys total]\n",
+                                        "!\t[%ld.%06ld s user, %ld.%06ld s system total]\n",
                                         (long) user.tv_sec,
                                         (long) user.tv_usec,
                                         (long) sys.tv_sec,
index 8781a383c082154cb032545f96e4e46b86b0ab07..6602663e426fdcc0cc22d923591caeb9280dcb30 100644 (file)
@@ -61,11 +61,11 @@ pg_rusage_show(const PGRUsage *ru0)
        }
 
        snprintf(result, sizeof(result),
-                        "CPU %d.%02ds/%d.%02du sec elapsed %d.%02d sec",
-                        (int) (ru1.ru.ru_stime.tv_sec - ru0->ru.ru_stime.tv_sec),
-                 (int) (ru1.ru.ru_stime.tv_usec - ru0->ru.ru_stime.tv_usec) / 10000,
+                        "CPU: user: %d.%02d s, system: %d.%02d s, elapsed: %d.%02d s",
                         (int) (ru1.ru.ru_utime.tv_sec - ru0->ru.ru_utime.tv_sec),
                  (int) (ru1.ru.ru_utime.tv_usec - ru0->ru.ru_utime.tv_usec) / 10000,
+                        (int) (ru1.ru.ru_stime.tv_sec - ru0->ru.ru_stime.tv_sec),
+                 (int) (ru1.ru.ru_stime.tv_usec - ru0->ru.ru_stime.tv_usec) / 10000,
                         (int) (ru1.tv.tv_sec - ru0->tv.tv_sec),
                         (int) (ru1.tv.tv_usec - ru0->tv.tv_usec) / 10000);