| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 2 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 3 * Distributed under the terms of the GNU General Public License v2 | 3 * Distributed under the terms of the GNU General Public License v2 |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 #ifndef _KTOP_H | 6 #ifndef _KTOP_H_ |
| 7 #define _KTOP_H 1 | 7 #define _KTOP_H_ 1 |
| 8 | 8 |
| 9 #ifndef _STYLE_H_ | 9 #ifndef _STYLE_H_ |
| 10 #include <style.h> | 10 #include <style.h> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #ifndef _SYSCALL_H_ | 13 #ifndef _SYSCALL_H_ |
| 14 #include "syscall.h" | 14 #include "syscall.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 enum { MAX_PID = 1 << 15, | 17 enum { MAX_PID = 1 << 15, |
| 18 » MAX_PIDCALLS = 1 << 13, | 18 » MAX_PIDCALLS = 1 << 10, |
| 19 MAX_NAME = 1 << 12, | 19 MAX_NAME = 1 << 12, |
| 20 SYSCALL_SHIFT = 9, | 20 SYSCALL_SHIFT = 9, |
| 21 » SYSCALL_MASK = (1 << SYSCALL_SHIFT) - 1 }; | 21 » SYSCALL_MASK = (1 << SYSCALL_SHIFT) - 1, |
| 22 » NUM_ARGS = 6 }; |
| 22 | 23 |
| 23 CHECK_CONST((1 << SYSCALL_SHIFT) >= NUM_SYS_CALLS); | 24 CHECK_CONST((1 << SYSCALL_SHIFT) >= NUM_SYS_CALLS); |
| 24 | 25 |
| 25 static inline u32 mkpidcall(int pid, int syscall) | 26 static inline u32 mkpidcall(int pid, int syscall) |
| 26 { | 27 { |
| 27 return pid << SYSCALL_SHIFT | syscall; | 28 return pid << SYSCALL_SHIFT | syscall; |
| 28 } | 29 } |
| 29 | 30 |
| 30 static inline u32 get_pid(int pidcall) | 31 static inline u32 get_pid(int pidcall) |
| 31 { | 32 { |
| 32 return pidcall >> SYSCALL_SHIFT; | 33 return pidcall >> SYSCALL_SHIFT; |
| 33 } | 34 } |
| 34 | 35 |
| 35 static inline u32 get_call(u32 pidcall) | 36 static inline u32 get_call(u32 pidcall) |
| 36 { | 37 { |
| 37 return pidcall & SYSCALL_MASK; | 38 return pidcall & SYSCALL_MASK; |
| 38 } | 39 } |
| 39 | 40 |
| 40 typedef struct Pidcall_s { | 41 typedef void (*display_fn)(void); |
| 42 |
| 43 typedef struct Pidcall_s Pidcall_s; |
| 44 struct Pidcall_s { |
| 45 » Pidcall_s *next; |
| 41 u32 pidcall; | 46 u32 pidcall; |
| 42 u32 count; | 47 u32 count; |
| 43 } Pidcall_s; | 48 » unint clock; |
| 44 | 49 » struct { |
| 45 typedef struct Collector_args_s { | 50 » » u64 start; |
| 46 » int» cpu_id; | 51 » » u64 total; |
| 47 } Collector_args_s; | 52 » } time; |
| 53 » struct { |
| 54 » » u32 count; |
| 55 » » u64 time; |
| 56 » } save; |
| 57 » unint arg[NUM_ARGS]; |
| 58 » char *name; |
| 59 }; |
| 48 | 60 |
| 49 extern bool Dump; /* Dump of ftrace logs - don't start display */ | 61 extern bool Dump; /* Dump of ftrace logs - don't start display */ |
| 50 extern bool Trace_exit; /* Trace sys_exit events */ | 62 extern bool Trace_exit; /* Trace sys_exit events */ |
| 51 extern bool Trace_self; /* Trace myself and ignore others */ | 63 extern bool Trace_self; /* Trace myself and ignore others */ |
| 52 | 64 |
| 65 extern display_fn Display; |
| 66 void internal_display(void); |
| 67 void kernel_display(void); |
| 68 void file_system_display(void); |
| 69 |
| 53 extern u64 Syscall_count[NUM_SYS_CALLS]; | 70 extern u64 Syscall_count[NUM_SYS_CALLS]; |
| 54 extern int Pid[MAX_PID]; | 71 extern int Pid[MAX_PID]; |
| 55 extern Pidcall_s Pidcall[MAX_PIDCALLS]; | 72 extern Pidcall_s Pidcall[MAX_PIDCALLS]; |
| 56 extern Pidcall_s *Pidnext; | 73 extern u64 PidcallRecord; |
| 74 extern u64 PidcallIterations; |
| 75 extern u64 Pidcall_tick; |
| 76 |
| 77 extern u64 No_enter; |
| 78 extern u64 Found; |
| 79 extern u64 Out_of_order; |
| 80 extern u64 No_start; |
| 57 | 81 |
| 58 extern u64 MyPidCount; | 82 extern u64 MyPidCount; |
| 59 extern u64 Slept; | 83 extern u64 Slept; |
| 60 extern int Command; | 84 extern bool Halt; |
| 61 | 85 |
| 62 void cleanup(int sig); | 86 void cleanup(int sig); |
| 63 | 87 |
| 64 void cleanup_collector(void); | 88 void cleanup_collector(void); |
| 65 void start_collector(void); | 89 void start_collector(void); |
| 66 | 90 |
| 67 void *display(void *arg); | 91 void *reduce(void *arg); |
| 92 void decrease_reduce_interval(void); |
| 93 void increase_reduce_interval(void); |
| 94 void reset_reduce(void); |
| 95 |
| 68 void cleanup_display(void); | 96 void cleanup_display(void); |
| 69 void clear_display(void); | 97 void clear_display(void); |
| 70 | 98 |
| 71 pid_t gettid(void); | 99 pid_t gettid(void); |
| 72 void ignore_pid(int pid); | 100 void ignore_pid(int pid); |
| 73 bool do_ignore_pid(int pid); | 101 bool do_ignore_pid(int pid); |
| 74 | 102 |
| 75 void graph(void); | 103 void graph(void); |
| 76 | 104 |
| 77 #endif | 105 #endif |
| OLD | NEW |