do not collect guest usage when running without-guest
Costa Tsaousis committed
Jul 27, 2016 at 21:33 UTC
cfca464a03781bc92a5bb473a38b124b7d49f4b9
1 file changed
+12
-12
src/apps_plugin.c
+12
-12
@@ -782,15 +782,15 @@ int read_proc_pid_stat(struct pid_stat *p) {
782
// p->policy = strtoul(procfile_lineword(ff, 0, 40), NULL, 10);
783
// p->delayacct_blkio_ticks = strtoull(procfile_lineword(ff, 0, 41), NULL, 10);
784
785
- last = p->gtime_raw;
786
- p->gtime_raw = strtoull(procfile_lineword(ff, 0, 42), NULL, 10);
787
- p->gtime = (p->gtime_raw - last) * (1000000ULL * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
785
+ if(enable_guest_charts) {
786
+ last = p->gtime_raw;
787
+ p->gtime_raw = strtoull(procfile_lineword(ff, 0, 42), NULL, 10);
788
+ p->gtime = (p->gtime_raw - last) * (1000000ULL * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
789
789
- last = p->cgtime_raw;
790
- p->cgtime_raw = strtoull(procfile_lineword(ff, 0, 43), NULL, 10);
791
- p->cgtime = (p->cgtime_raw - last) * (1000000ULL * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
790
+ last = p->cgtime_raw;
791
+ p->cgtime_raw = strtoull(procfile_lineword(ff, 0, 43), NULL, 10);
792
+ p->cgtime = (p->cgtime_raw - last) * (1000000ULL * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
793
793
- if(enable_guest_charts) {
794
if (show_guest_time || p->gtime || p->cgtime) {
795
p->utime -= (p->utime >= p->gtime) ? p->gtime : p->utime;
796
p->cutime -= (p->cutime >= p->cgtime) ? p->cgtime : p->cutime;
@@ -988,12 +988,12 @@ int read_proc_stat() {
988
gtime_raw = strtoull(procfile_lineword(ff, 0, 10), NULL, 10);
989
global_gtime = (gtime_raw - last) * (1000000ULL * RATES_DETAIL) / (collected_usec - last_collected_usec);
990
991
- // guest nice time, on guest time
992
- last = gntime_raw;
993
- gntime_raw = strtoull(procfile_lineword(ff, 0, 11), NULL, 10);
994
- global_gtime += (gntime_raw - last) * (1000000ULL * RATES_DETAIL) / (collected_usec - last_collected_usec);
995
-
991
if(enable_guest_charts) {
992
+ // guest nice time, on guest time
993
+ last = gntime_raw;
994
+ gntime_raw = strtoull(procfile_lineword(ff, 0, 11), NULL, 10);
995
+ global_gtime += (gntime_raw - last) * (1000000ULL * RATES_DETAIL) / (collected_usec - last_collected_usec);
996
+
997
// remove guest time from user time
998
global_utime -= (global_utime > global_gtime) ? global_gtime : global_utime;
999
}