#include <util/gpu-mem.h>
static int have_smaps_rollup;
+static bool need_tgid_taskstat_add_time;
static struct gpu_mem_node *gpu_mem_node;
static int __get_cpu_num(char *path)
memcpy(stats->ac_comm, pid_stats.ac_comm, strlen(pid_stats.ac_comm) + 1);
}
+ if (need_tgid_taskstat_add_time) {
+ stats->ac_etime += pid_stats.ac_etime;
+ stats->ac_utime += pid_stats.ac_utime;
+ stats->ac_stime += pid_stats.ac_stime;
+ }
+
stats->virtmem += pid_stats.virtmem;
stats->coremem += pid_stats.coremem;
stats->read_bytes += pid_stats.read_bytes;
static void __CONSTRUCTOR__ kernel_init(void)
{
+ struct taskstats self;
+
have_smaps_rollup = !access("/proc/self/smaps_rollup", R_OK);
gpu_mem_node = get_system_gpu_mem_node();
+
+ kernel_get_thread_group_taskstats(&self, getpid(), false);
+ if (self.ac_etime == 0)
+ need_tgid_taskstat_add_time = true;
}