| 1 | /* |
| 2 | * Copyright (C) 2011 Julien Desfossez |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License Version 2 as |
| 6 | * published by the Free Software Foundation; |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License along |
| 14 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 16 | */ |
| 17 | |
| 18 | #ifndef LTTNGTOPTYPES_H |
| 19 | #define LTTNGTOPTYPES_H |
| 20 | |
| 21 | #include <glib.h> |
| 22 | |
| 23 | struct lttngtop { |
| 24 | GPtrArray *process_table; /* struct processtop */ |
| 25 | GPtrArray *files_table; /* struct files */ |
| 26 | GPtrArray *cpu_table; /* struct cputime */ |
| 27 | GHashTable *perf_list; /* struct perfcounter */ |
| 28 | unsigned long start; |
| 29 | unsigned long end; |
| 30 | unsigned int nbproc; |
| 31 | unsigned int nbnewproc; |
| 32 | unsigned int nbdeadproc; |
| 33 | unsigned int nbthreads; |
| 34 | unsigned int nbnewthreads; |
| 35 | unsigned int nbdeadthreads; |
| 36 | unsigned int nbfiles; |
| 37 | unsigned int nbnewfiles; |
| 38 | unsigned int nbclosedfiles; |
| 39 | } lttngtop; |
| 40 | |
| 41 | struct processtop { |
| 42 | unsigned int puuid; |
| 43 | int pid; |
| 44 | char *comm; |
| 45 | int tid; |
| 46 | int ppid; |
| 47 | int oldpid; |
| 48 | int oldtid; |
| 49 | int oldppid; |
| 50 | unsigned long birth; |
| 51 | unsigned long death; |
| 52 | unsigned long lastactivity; |
| 53 | /* Files managing */ |
| 54 | GPtrArray *process_files_table; |
| 55 | struct file_history *files_history; |
| 56 | GPtrArray *threads; |
| 57 | GHashTable *perf; |
| 58 | struct processtop *threadparent; |
| 59 | /* IO calculting */ |
| 60 | unsigned long totalfileread; |
| 61 | unsigned long totalfilewrite; |
| 62 | unsigned long fileread; |
| 63 | unsigned long filewrite; |
| 64 | struct syscalls *syscall_info; |
| 65 | unsigned long totalcpunsec; |
| 66 | unsigned long threadstotalcpunsec; |
| 67 | }; |
| 68 | |
| 69 | struct perfcounter |
| 70 | { |
| 71 | unsigned long count; |
| 72 | int visible; |
| 73 | int sort; |
| 74 | }; |
| 75 | |
| 76 | struct cputime { |
| 77 | guint id; |
| 78 | struct processtop *current_task; |
| 79 | unsigned long task_start; |
| 80 | GHashTable *perf; |
| 81 | }; |
| 82 | |
| 83 | /* |
| 84 | * used for "relative seeks" (with fd, for example fs.lseek) |
| 85 | * and for "absolute seeks" (events occuring on a device without |
| 86 | * any link to a particular process) |
| 87 | */ |
| 88 | struct seeks { |
| 89 | unsigned long offset; |
| 90 | unsigned long count; |
| 91 | }; |
| 92 | |
| 93 | struct ioctls { |
| 94 | unsigned int command; |
| 95 | unsigned long count; |
| 96 | }; |
| 97 | |
| 98 | struct files { |
| 99 | struct processtop *ref; |
| 100 | unsigned int fuuid; |
| 101 | int fd; |
| 102 | char *name; |
| 103 | int oldfd; |
| 104 | int device; |
| 105 | int openmode; |
| 106 | int flag; |
| 107 | unsigned long openedat; |
| 108 | unsigned long closedat; |
| 109 | unsigned long lastaccess; |
| 110 | unsigned long read; |
| 111 | unsigned long write; |
| 112 | unsigned long nbpoll; |
| 113 | unsigned long nbselect; |
| 114 | unsigned long nbopen; |
| 115 | unsigned long nbclose; |
| 116 | //struct *seeks; /* relative seeks inside the file */ |
| 117 | //struct *ioctls; |
| 118 | /* XXX : average wait time */ |
| 119 | }; |
| 120 | |
| 121 | struct file_history { |
| 122 | struct files *file; |
| 123 | struct file_history *next; |
| 124 | }; |
| 125 | |
| 126 | struct sockets { |
| 127 | int fd; |
| 128 | int parent_fd; /* on accept a new fd is created from the bound socket */ |
| 129 | int family; |
| 130 | int type; |
| 131 | int protocol; |
| 132 | int sock_address; |
| 133 | unsigned long openedat; |
| 134 | unsigned long closedat; |
| 135 | unsigned long bind_address; |
| 136 | unsigned long remote_address; |
| 137 | //struct *sock_options; |
| 138 | }; |
| 139 | |
| 140 | struct sock_options { |
| 141 | int name; |
| 142 | int value; |
| 143 | }; |
| 144 | |
| 145 | struct vmas { |
| 146 | unsigned long start; |
| 147 | unsigned long end; |
| 148 | unsigned long flags; |
| 149 | unsigned long prot; |
| 150 | char *description; /* filename or description if possible (stack, heap) */ |
| 151 | unsigned long page_faults; |
| 152 | }; |
| 153 | |
| 154 | struct syscalls { |
| 155 | unsigned int id; |
| 156 | unsigned long count; |
| 157 | uint64_t cpu_id; |
| 158 | unsigned int type; |
| 159 | unsigned int tid; |
| 160 | unsigned int fd; |
| 161 | }; |
| 162 | |
| 163 | struct signals { |
| 164 | int dest_pid; |
| 165 | int id; |
| 166 | unsigned long count; |
| 167 | }; |
| 168 | |
| 169 | struct file_info { |
| 170 | struct file_info *next; |
| 171 | char *name; |
| 172 | int fd; |
| 173 | int status; |
| 174 | }; |
| 175 | |
| 176 | #endif /* LTTNGTOPTYPES_H */ |