int
kernel_get_thread_group_map_info(struct proc_map_info *map_info, pid_t tgid, bool include_gpu_mem);
bool kernel_check_gpu_support(void);
+bool kernel_check_taskstat_support(void);
#endif
static int have_smaps_rollup;
static bool need_tgid_taskstat_add_time;
static struct gpu_mem_node *gpu_mem_node;
+static bool taskstat_support;
static int __get_cpu_num(char *path)
{
return !!gpu_mem_node;
}
+bool kernel_check_taskstat_support(void)
+{
+ return taskstat_support;
+}
+
static void __CONSTRUCTOR__ kernel_init(void)
{
struct taskstats self;
+ int ret;
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);
+ ret = kernel_get_thread_group_taskstats(&self, getpid(), false);
+ if (ret < 0) {
+ _I("taskstat is not supported.\n");
+ return;
+ }
+ taskstat_support = true;
if (self.ac_etime == 0)
need_tgid_taskstat_add_time = true;
}