hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/kernel_stat.h
....@@ -78,6 +78,24 @@
7878 return kstat_cpu(cpu).irqs_sum;
7979 }
8080
81
+#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
82
+extern u64 kcpustat_field(struct kernel_cpustat *kcpustat,
83
+ enum cpu_usage_stat usage, int cpu);
84
+extern void kcpustat_cpu_fetch(struct kernel_cpustat *dst, int cpu);
85
+#else
86
+static inline u64 kcpustat_field(struct kernel_cpustat *kcpustat,
87
+ enum cpu_usage_stat usage, int cpu)
88
+{
89
+ return kcpustat->cpustat[usage];
90
+}
91
+
92
+static inline void kcpustat_cpu_fetch(struct kernel_cpustat *dst, int cpu)
93
+{
94
+ *dst = kcpustat_cpu(cpu);
95
+}
96
+
97
+#endif
98
+
8199 extern void account_user_time(struct task_struct *, u64);
82100 extern void account_guest_time(struct task_struct *, u64);
83101 extern void account_system_time(struct task_struct *, int, u64);
....@@ -85,6 +103,7 @@
85103 enum cpu_usage_stat);
86104 extern void account_steal_time(u64);
87105 extern void account_idle_time(u64);
106
+extern u64 get_idle_time(struct kernel_cpustat *kcs, int cpu);
88107
89108 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
90109 static inline void account_process_tick(struct task_struct *tsk, int user)