]> granicus.if.org Git - sysstat/commitdiff
Skipping missing CPU and to interrupt statistics
authorAlexander Troosh <trush@yandex.ru>
Wed, 9 Oct 2013 14:22:38 +0000 (18:22 +0400)
committerAlexander Troosh <trush@yandex.ru>
Wed, 9 Oct 2013 14:22:38 +0000 (18:22 +0400)
mpstat.c
rd_stats.c
rd_stats.h

index 43e9c87fc7483aa07863542bbaa50fae97b37477..f28a3677d9964f7103ee843ea647d3ea1f817ce9 100644 (file)
--- a/mpstat.c
+++ b/mpstat.c
@@ -257,6 +257,9 @@ void write_irqcpu_stats(struct stats_irqcpu *st_ic[], int ic_nr, int dis,
 
                scc = st_cpu[curr] + cpu;
 
+               /* Check CPU presence */
+               if (!scc->present)
+                   continue;
                /*
                 * Check if we want stats about this CPU.
                 * CPU must have been explicitly selected using option -P,
@@ -414,8 +417,8 @@ void write_stats_core(int prev, int curr, int dis,
                        scc = st_cpu[curr] + cpu;
                        scp = st_cpu[prev] + cpu;
 
-                       /* Check CPU online */
-                       if (!scc->online)
+                       /* Check CPU presence */
+                       if (!scc->present)
                                continue;
                        /* Check if we want stats about this proc */
                        if (!(*(cpu_bitmap + (cpu >> 3)) & (1 << (cpu & 0x07))))
@@ -520,6 +523,9 @@ void write_stats_core(int prev, int curr, int dis,
                        scc = st_cpu[curr] + cpu;
                        scp = st_cpu[prev] + cpu;
 
+                       /* Check CPU presence */
+                       if (!scc->present)
+                               continue;
                        /* Check if we want stats about this proc */
                        if (!(*(cpu_bitmap + (cpu >> 3)) & (1 << (cpu & 0x07))))
                                continue;
index f05f1dd1e7c11bcf96f81ff6fc876176a965afa5..10c3e7d6262fca23b84c67f62cbc33734cc4a2fd 100644 (file)
@@ -71,7 +71,7 @@ void read_stat_cpu(struct stats_cpu *st_cpu, int nbr,
        }
 
        for (proc_nb = 1; proc_nb < nbr; proc_nb++) {
-               (st_cpu + proc_nb)->online = 0;
+               (st_cpu + proc_nb)->present = 0;
        }
 
        while (fgets(line, 8192, fp) != NULL) {
@@ -119,7 +119,7 @@ void read_stat_cpu(struct stats_cpu *st_cpu, int nbr,
                        if (nbr > 1) {
                                /* All the fields don't necessarily exist */
                                memset(&sc, 0, STATS_CPU_SIZE);
-                               sc.online = 1;
+                               sc.present = 1;
                                /*
                                 * Read the number of jiffies spent in the different modes
                                 * (user, nice, etc) for current proc.
index 5c4d72eb52e0d69209745a8ce607b1bfb73d43e4..aab5eb6c24828ce08536f0c03780ef3b9d65067f 100644 (file)
@@ -90,7 +90,7 @@ struct stats_cpu {
        unsigned long long cpu_softirq          __attribute__ ((aligned (16)));
        unsigned long long cpu_guest            __attribute__ ((aligned (16)));
        unsigned long long cpu_guest_nice       __attribute__ ((aligned (16)));
-       char               online;
+       char               present;
 };
 
 #define STATS_CPU_SIZE (sizeof(struct stats_cpu))