aboutsummaryrefslogtreecommitdiff
path: root/include/linux/task_cpustats.h
blob: d89ae7d54490b3eac0f066995b86a414fe0820e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2020 Oplus. All rights reserved.
 */

#ifndef _OPLUS_TASK_CPUSTATS_H
#define _OPLUS_TASK_CPUSTATS_H
#include <linux/kernel_stat.h>
#include <linux/cpufreq.h>

#define MAX_CTP_WINDOW (10 * NSEC_PER_SEC / TICK_NSEC)

struct task_cpustat {
	pid_t pid;
	pid_t tgid;
	enum cpu_usage_stat type;
	int freq;
	unsigned long begin;
	unsigned long end;
	char comm[TASK_COMM_LEN];
};

struct kernel_task_cpustat {
	unsigned int idx;
	struct task_cpustat cpustat[MAX_CTP_WINDOW];
};

DECLARE_PER_CPU(struct kernel_task_cpustat, ktask_cpustat);

extern unsigned int sysctl_task_cpustats_enable;
extern void account_task_time(struct task_struct *p, unsigned int ticks,
		enum cpu_usage_stat type);
#endif