]> granicus.if.org Git - sysstat/commitdiff
pidstat: Update variables type to be consistent with recent kernels
authorSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 21 May 2014 19:37:50 +0000 (21:37 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 21 May 2014 19:37:50 +0000 (21:37 +0200)
Many counters used in /proc files have changed from long int to
long long int. So update the variables type used by pidstat accordingly.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
pidstat.c
pidstat.h

index 04047ef67938eac36c328413ffcef7037ec34332..72f558ec356e8f1b3aae4106d0c39d16289f5d4c 100644 (file)
--- a/pidstat.c
+++ b/pidstat.c
@@ -322,10 +322,10 @@ int read_proc_pid_stat(unsigned int pid, struct pid_stats *pst,
                /* No such process */
                return 1;
 
-       sprintf(format, "%%*d (%%%ds %%*s %%*d %%*d %%*d %%*d %%*d %%*u %%lu %%lu"
-               " %%lu %%lu %%lu %%lu %%lu %%lu %%*d %%*d %%u %%*u %%*d %%lu %%lu"
+       sprintf(format, "%%*d (%%%ds %%*s %%*d %%*d %%*d %%*d %%*d %%*u %%llu %%llu"
+               " %%llu %%llu %%llu %%llu %%lld %%lld %%*d %%*d %%u %%*u %%*d %%llu %%llu"
                " %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u"
-               " %%*u %%u %%u %%u %%llu %%lu %%lu\\n", MAX_COMM_LEN);
+               " %%*u %%u %%u %%u %%llu %%llu %%lld\\n", MAX_COMM_LEN);
 
        fscanf(fp, format, comm,
               &pst->minflt, &pst->cminflt, &pst->majflt, &pst->cmajflt,
@@ -1291,7 +1291,7 @@ int write_pid_task_all_stats(int prev, int curr, int dis,
                }
 
                if (DISPLAY_MEM(actflag)) {
-                       printf(" %9.2f %9.2f %7lu %6lu %6.2f",
+                       printf(" %9.2f %9.2f %7llu %6llu %6.2f",
                               S_VALUE(pstp->minflt, pstc->minflt, itv),
                               S_VALUE(pstp->majflt, pstc->majflt, itv),
                               pstc->vsz,
@@ -1407,7 +1407,7 @@ int write_pid_child_all_stats(int prev, int curr, int dis,
 
 
                if (DISPLAY_MEM(actflag)) {
-                       printf(" %9lu %9lu",
+                       printf(" %9llu %9llu",
                               (pstc->minflt + pstc->cminflt) - (pstp->minflt + pstp->cminflt),
                               (pstc->majflt + pstc->cmajflt) - (pstp->majflt + pstp->cmajflt));
                }
@@ -1644,7 +1644,7 @@ int write_pid_task_memory_stats(int prev, int curr, int dis, int disp_avg,
                               : 0.0);
                }
                else {
-                       printf("%7lu %6lu %6.2f",
+                       printf("%7llu %6llu %6.2f",
                               pstc->vsz,
                               pstc->rss,
                               tlmkb ? SP_VALUE(0, pstc->rss, tlmkb) : 0.0);
@@ -1715,7 +1715,7 @@ int write_pid_child_memory_stats(int prev, int curr, int dis, int disp_avg,
                                         (pstp->majflt + pstp->cmajflt)) / pstc->rc_asum_count);
                }
                else {
-                       printf(" %9lu %9lu",
+                       printf(" %9llu %9llu",
                               (pstc->minflt + pstc->cminflt) - (pstp->minflt + pstp->cminflt),
                               (pstc->majflt + pstc->cmajflt) - (pstp->majflt + pstp->cmajflt));
                }
index 9876d50627c388b938dd4743a07ca2d5987e815b..14531c1ba734543c1babf60238c598267eab71c7 100644 (file)
--- a/pidstat.h
+++ b/pidstat.h
        "?")))))
                                
 struct pid_stats {
-       unsigned long long read_bytes                   __attribute__ ((aligned (8)));
+       unsigned long long read_bytes                   __attribute__ ((aligned (16)));
        unsigned long long write_bytes                  __attribute__ ((packed));
        unsigned long long cancelled_write_bytes        __attribute__ ((packed));
        unsigned long long total_vsz                    __attribute__ ((packed));
@@ -124,18 +124,18 @@ struct pid_stats {
        unsigned long long total_threads                __attribute__ ((packed));
        unsigned long long total_fd_nr                  __attribute__ ((packed));
        unsigned long long blkio_swapin_delays          __attribute__ ((packed));
-       unsigned long      minflt                       __attribute__ ((packed));
-       unsigned long      cminflt                      __attribute__ ((packed));
-       unsigned long      majflt                       __attribute__ ((packed));
-       unsigned long      cmajflt                      __attribute__ ((packed));
-       unsigned long      utime                        __attribute__ ((packed));
-       unsigned long      cutime                       __attribute__ ((packed));
-       unsigned long      stime                        __attribute__ ((packed));
-       unsigned long      cstime                       __attribute__ ((packed));
-       unsigned long      gtime                        __attribute__ ((packed));
-       unsigned long      cgtime                       __attribute__ ((packed));
-       unsigned long      vsz                          __attribute__ ((packed));
-       unsigned long      rss                          __attribute__ ((packed));
+       unsigned long long minflt                       __attribute__ ((packed));
+       unsigned long long cminflt                      __attribute__ ((packed));
+       unsigned long long majflt                       __attribute__ ((packed));
+       unsigned long long cmajflt                      __attribute__ ((packed));
+       unsigned long long utime                        __attribute__ ((packed));
+       long long          cutime                       __attribute__ ((packed));
+       unsigned long long stime                        __attribute__ ((packed));
+       long long          cstime                       __attribute__ ((packed));
+       unsigned long long gtime                        __attribute__ ((packed));
+       long long          cgtime                       __attribute__ ((packed));
+       unsigned long long vsz                          __attribute__ ((packed));
+       unsigned long long rss                          __attribute__ ((packed));
        unsigned long      nvcsw                        __attribute__ ((packed));
        unsigned long      nivcsw                       __attribute__ ((packed));
        unsigned long      stack_size                   __attribute__ ((packed));