[ovs-dev,2/2] system-stats: Include core number in the process stats.

Message ID 1510174167-71108-2-git-send-email-bhanuprakash.bodireddy@intel.com
State New
Headers show
Series
  • [ovs-dev,1/2] process: Extend get_process_info() for additional fields.
Related show

Commit Message

Bhanuprakash Bodireddy Nov. 8, 2017, 8:49 p.m.
When dumping process statistics, include the the core number the process
was last scheduled. With 'other_config:enable-statistics=true',

Before:
  {cpu="28", file_systems="/,8474624,7826220 /workspace,223835956,199394160",
  load_average="1.29,1.76,1.33", memory="65861460,27457540,3813488,1999868,0",
  process_ovs-vswitchd="4685896,17452,362920,0,383967,383967",
  process_ovsdb-server="48088,5172,60,0,384057,384057"}

After:
  {cpu="28", file_systems="/,8474624,7826308 /workspace,223835956,199394172",
  load_average="1.30,1.04,1.13", memory="65861460,27469176,3815252,1999868,0",
  process_ovs-vswitchd="4686020,17360,127380,0,148406,148406,3",
  process_ovsdb-server="48096,5212,30,0,148496,148496,4"}

eg:
      process    vsz   , rss , cputime, crashes, booted, uptime, core_id
  ovs-vswitchd="4686020,17360, 127380,      0  , 148406, 148406,  3"

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
---
 vswitchd/system-stats.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/vswitchd/system-stats.c b/vswitchd/system-stats.c
index b780476..aaab676 100644
--- a/vswitchd/system-stats.c
+++ b/vswitchd/system-stats.c
@@ -205,9 +205,10 @@  get_process_stats(struct smap *stats)
                         (int) (extension - de->d_name), de->d_name);
         if (!smap_get(stats, key)) {
             if (LINUX && get_process_info(pid, &pinfo)) {
-                smap_add_format(stats, key, "%lu,%lu,%lld,%d,%lld,%lld",
+                smap_add_format(stats, key, "%lu,%lu,%lld,%d,%lld,%lld,%d",
                                 pinfo.vsz, pinfo.rss, pinfo.cputime,
-                                pinfo.crashes, pinfo.booted, pinfo.uptime);
+                                pinfo.crashes, pinfo.booted, pinfo.uptime,
+                                pinfo.core_id);
             } else {
                 smap_add(stats, key, "");
             }