2 *------------------------------------------------------------------
3 * Copyright (c) 2005-2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * typedefs and so forth
20 #include <sys/types.h>
21 #include <gtk-2.0/gtk/gtk.h>
26 typedef unsigned long long ulonglong;
32 extern GtkWidget *g_mainwindow;
33 extern GtkWidget *g_mainvbox;
34 extern GtkWidget *g_mainhbox;
39 void point_selector_init(void);
40 boolean read_event_definitions (char *filename);
42 void pointsel_about(char *);
43 void pointsel_next_snapshot(void);
44 void initialize_events(void);
45 void finalize_events(void);
47 #define NEVENTS 100000
49 typedef struct event_def_ {
58 extern event_def_t *find_event_definition (ulong code);
60 extern event_def_t g_eventdefs[NEVENTS];
65 extern int c_maxpointsel; /* max # points shown in selector dlg */
66 extern gint c_view1_draw_width;
67 extern gint c_view1_draw_height;
73 void menu1_init(void);
74 void modal_dialog (char *label_text, char *retry_text, char *default_value,
75 boolean (*cb)(char *));
76 void infobox(char *label_text, char *text);
80 extern GdkFont *g_font;
81 extern GdkColor fg_black, bg_white;
82 void view1_init(void);
83 void view1_display(void);
84 void view1_read_events_callback(void);
85 void view1_display_when_idle(void);
86 void view1_print_callback(GtkToggleButton *item, gpointer data);
87 void view1_about(char *);
88 void set_pid_ax_width(int width);
89 void set_window_title(const char *filename);
92 TBOX_DRAW_BOXED = 1, /* note: order counts */
97 TBOX_PRINT_PLAIN, /* end restriction */
109 GdkRectangle *tbox (char *s, int x, int y, enum view1_tbox_fn function);
110 void line (int x1, int y1, int x2, int y2, enum view1_line_fn function);
111 gint view1_handle_key_press_event (GtkWidget *widget, GdkEventKey *event);
117 void events_about (char *);
119 typedef struct raw_event {
120 unsigned long time[2];
126 void event_init(void);
127 char *mapfile (char *file, ulong *sizep);
128 boolean unmapfile (char *addr, ulong size);
129 void read_events (char *);
130 int find_event_index (ulonglong t);
131 int read_cpel_file(char *file);
132 int read_clib_file(char *file);
133 void cpel_event_init(ulong);
134 void add_event_from_cpel_file(ulong, char * , char *);
135 void add_event_from_clib_file(unsigned int event, char *name,
136 unsigned int vec_index);
137 void add_cpel_event(ulonglong delta, ulong, ulong, ulong);
138 void add_clib_event(double delta, unsigned short track,
139 unsigned short event, unsigned int index);
140 void cpel_event_finalize(void);
141 void *get_clib_event (unsigned int datum);
143 typedef struct pid_data {
144 struct pid_data *next;
145 ulong pid_value; /* The actual pid value */
146 ulong pid_index; /* Index in pid sort order */
149 #define EVENT_FLAG_SELECT 0x00000001 /* This event is selected */
150 #define EVENT_FLAG_SEARCHRSLT 0x00000002 /* This event is the search rslt */
151 #define EVENT_FLAG_CLIB 0x00000004 /* clib event */
153 typedef struct pid_sort {
154 struct pid_data *pid;
157 * This is a bit of a hack, since this is used only by the view:
159 unsigned color_index;
163 typedef struct event {
172 extern boolean g_little_endian;
173 extern event_t *g_events;
174 extern ulong g_nevents;
175 extern pid_sort_t *g_pids;
176 extern pid_sort_t *g_original_pids;
178 extern pid_data_t *g_pid_data_list;
180 #define PIDHASH_NBUCKETS 20021 /* Should be prime */
182 extern boolean ticks_per_ns_set;
183 extern double ticks_per_ns;
188 extern const char *version_string;
189 extern const char *minor_v_string;
194 char *get_track_label(unsigned long);
195 extern int widest_track_format;
196 char *strtab_ref(unsigned long);