| 1 | /* This file is part of the Linux Trace Toolkit viewer |
| 2 | * Copyright (C) 2006 Parisa heidari (inspired from CFV by Mathieu Desnoyers) |
| 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 |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 16 | * MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifdef HAVE_CONFIG_H |
| 20 | #include <config.h> |
| 21 | #endif |
| 22 | |
| 23 | #include <gtk/gtk.h> |
| 24 | #include <gdk/gdk.h> |
| 25 | #include <string.h> |
| 26 | |
| 27 | #include <ltt/trace.h> |
| 28 | |
| 29 | #include <lttv/lttv.h> |
| 30 | #include <lttv/tracecontext.h> |
| 31 | #include <lttvwindow/lttvwindow.h> |
| 32 | #include <lttv/state.h> |
| 33 | #include <lttv/hook.h> |
| 34 | |
| 35 | #include "histodrawing.h" |
| 36 | #include "histoeventhooks.h" |
| 37 | #include "histocfv.h" |
| 38 | |
| 39 | #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format) |
| 40 | #define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format) |
| 41 | |
| 42 | //FIXME |
| 43 | // fixed #define TRACE_NUMBER 0 |
| 44 | #define EXTRA_ALLOC 1024 // pixels |
| 45 | #define padding_width 50 |
| 46 | |
| 47 | #if 0 /* colors for two lines representation */ |
| 48 | GdkColor histo_drawing_colors[NUM_COLORS] = |
| 49 | { /* Pixel, R, G, B */ |
| 50 | { 0, 0, 0, 0 }, /* COL_BLACK */ |
| 51 | { 0, 0xFFFF, 0xFFFF, 0xFFFF }, /* COL_WHITE */ |
| 52 | { 0, 0x0FFF, 0xFFFF, 0xFFFF }, /* COL_WAIT_FORK : pale blue */ |
| 53 | { 0, 0xFFFF, 0xFFFF, 0x0000 }, /* COL_WAIT_CPU : yellow */ |
| 54 | { 0, 0xFFFF, 0xA000, 0xFCFF }, /* COL_EXIT : pale magenta */ |
| 55 | { 0, 0xFFFF, 0x0000, 0xFFFF }, /* COL_ZOMBIE : purple */ |
| 56 | { 0, 0xFFFF, 0x0000, 0x0000 }, /* COL_WAIT : red */ |
| 57 | { 0, 0x0000, 0xFFFF, 0x0000 }, /* COL_RUN : green */ |
| 58 | { 0, 0x8800, 0xFFFF, 0x8A00 }, /* COL_USER_MODE : pale green */ |
| 59 | { 0, 0x09FF, 0x01FF, 0xFFFF }, /* COL_SYSCALL : blue */ |
| 60 | { 0, 0xF900, 0x4200, 0xFF00 }, /* COL_TRAP : pale purple */ |
| 61 | { 0, 0xFFFF, 0x5AFF, 0x01FF }, /* COL_IRQ : orange */ |
| 62 | { 0, 0xFFFF, 0xFFFF, 0xFFFF } /* COL_MODE_UNKNOWN : white */ |
| 63 | |
| 64 | }; |
| 65 | #endif //0 |
| 66 | |
| 67 | |
| 68 | GdkColor histo_drawing_colors[NUM_COLORS] = |
| 69 | { /* Pixel, R, G, B */ |
| 70 | { 0, 0, 0, 0 }, /* COL_BLACK */ |
| 71 | { 0, 0xFFFF, 0xFFFF, 0xFFFF }, /* COL_WHITE */ |
| 72 | { 0, 0x0000, 0xFF00, 0x0000 }, /* COL_RUN_USER_MODE : green */ |
| 73 | { 0, 0x0100, 0x9E00, 0xFFFF }, /* COL_RUN_SYSCALL : pale blue */ |
| 74 | { 0, 0xFF00, 0xFF00, 0x0100 }, /* COL_RUN_TRAP : yellow */ |
| 75 | { 0, 0xFFFF, 0x5E00, 0x0000 }, /* COL_RUN_IRQ : red */ |
| 76 | { 0, 0x6600, 0x0000, 0x0000 }, /* COL_WAIT : dark red */ |
| 77 | { 0, 0x7700, 0x7700, 0x0000 }, /* COL_WAIT_CPU : dark yellow */ |
| 78 | { 0, 0x6400, 0x0000, 0x5D00 }, /* COL_ZOMBIE : dark purple */ |
| 79 | { 0, 0x0700, 0x6400, 0x0000 }, /* COL_WAIT_FORK : dark green */ |
| 80 | { 0, 0x8900, 0x0000, 0x8400 }, /* COL_EXIT : "less dark" magenta */ |
| 81 | { 0, 0xFFFF, 0xFFFF, 0xFFFF }, /* COL_MODE_UNKNOWN : white */ |
| 82 | { 0, 0xFFFF, 0xFFFF, 0xFFFF } /* COL_UNNAMED : white */ |
| 83 | |
| 84 | }; |
| 85 | |
| 86 | /* |
| 87 | RUN+USER MODE green |
| 88 | RUN+SYSCALL |
| 89 | RUN+TRAP |
| 90 | RUN+IRQ |