| 1 | /* This file is part of the Linux Trace Toolkit Graphic User Interface |
| 2 | * Copyright (C) 2003-2004 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 | /* This file is the API used to launch any background computation on a trace */ |
| 20 | |
| 21 | #ifndef LTTVWINDOWTRACES_H |
| 22 | #define LTTVWINDOWTRACES_H |
| 23 | |
| 24 | #include <ltt/time.h> |
| 25 | #include <glib.h> |
| 26 | |
| 27 | typedef GQuark LttvTraceInfo; |
| 28 | |
| 29 | extern LttvTraceInfo LTTV_TRACES, |
| 30 | LTTV_COMPUTATION, |
| 31 | LTTV_REQUESTS_QUEUE, |
| 32 | LTTV_REQUESTS_CURRENT, |
| 33 | LTTV_NOTIFY_QUEUE, |
| 34 | LTTV_NOTIFY_CURRENT, |
| 35 | LTTV_COMPUTATION_TRACESET, |
| 36 | LTTV_COMPUTATION_TRACESET_CONTEXT, |
| 37 | LTTV_BEFORE_CHUNK_TRACESET, |
| 38 | LTTV_BEFORE_CHUNK_TRACE, |
| 39 | LTTV_BEFORE_CHUNK_TRACEFILE, |
| 40 | LTTV_AFTER_CHUNK_TRACESET, |
| 41 | LTTV_AFTER_CHUNK_TRACE, |
| 42 | LTTV_AFTER_CHUNK_TRACEFILE, |
| 43 | LTTV_BEFORE_REQUEST, |
| 44 | LTTV_AFTER_REQUEST, |
| 45 | LTTV_EVENT_HOOK, |
| 46 | LTTV_EVENT_HOOK_BY_ID, |
| 47 | LTTV_IN_PROGRESS, |
| 48 | LTTV_READY; |
| 49 | |
| 50 | |
| 51 | |
| 52 | /* Get a trace by its path name. |
| 53 | * |
| 54 | * @param path path of the trace on the virtual file system. |
| 55 | * @return Pointer to trace if found |
| 56 | * NULL is returned if the trace is not present |
| 57 | */ |
| 58 | |
| 59 | LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path); |
| 60 | |
| 61 | /* Get a trace by its number identifier */ |
| 62 | |
| 63 | LttvTrace *lttvwindowtraces_get_trace(guint num); |
| 64 | |
| 65 | /* Total number of traces */ |
| 66 | |
| 67 | guint lttvwindowtraces_get_number(); |
| 68 | |
| 69 | /* Add a trace to the global attributes */ |
| 70 | |
| 71 | void lttvwindowtraces_add_trace(LttvTrace *trace); |
| 72 | |
| 73 | /* Remove a trace from the global attributes */ |
| 74 | |
| 75 | void lttvwindowtraces_remove_trace(LttvTrace *trace); |
| 76 | |
| 77 | |
| 78 | /** |
| 79 | * Function to request data from a specific trace |
| 80 | * |
| 81 | * The memory allocated for the request will be managed by the API. |
| 82 | * |
| 83 | * @param trace the trace to compute |
| 84 | * @param module_name the name of the module which registered global computation |
| 85 | * hooks. |
| 86 | */ |
| 87 | |
| 88 | void lttvwindowtraces_background_request_queue |
| 89 | (LttvTrace *trace, gchar *module_name); |
| 90 | |
| 91 | /** |
| 92 | * Remove a background request from a trace. |
| 93 | * |
| 94 | * This should ONLY be used by the modules which registered the global hooks |
| 95 | * (module_name). If this is called by the viewers, it may lead to incomplete |
| 96 | * and incoherent background processing information. |
| 97 | * |
| 98 | * Even if the module which deals with the hooks removes the background |
| 99 | * requests, it may cause a problem if the module gets loaded again in the |
| 100 | * session : the data will be partially calculated. The calculation function |
| 101 | * must deal with this case correctly. |
| 102 | * |
| 103 | * @param trace the trace to compute |
| 104 | * @param module_name the name of the module which registered global computation |
| 105 | * hooks. |
| 106 | */ |
| 107 | |
| 108 | void lttvwindowtraces_background_request_remove |
| 109 | (LttvTrace *trace, gchar *module_name); |
| 110 | |
| 111 | /** |
| 112 | * Register a callback to be called when requested data is passed in the next |
| 113 | * queued background processing. |
| 114 | * |
| 115 | * @param owner owner of the background notification |
| 116 | * @param trace the trace computed |
| 117 | * @param notify_time time when notification hooks must be called |
| 118 | * @param notify_position position when notification hooks must be called |
| 119 | * @param notify Hook to call when the notify position is passed |
| 120 | */ |
| 121 | |
| 122 | void lttvwindowtraces_background_notify_queue |
| 123 | (gpointer owner, |
| 124 | LttvTrace *trace, |
| 125 | LttTime notify_time, |
| 126 | const LttvTracesetContextPosition *notify_position, |
| 127 | const LttvHooks *notify); |
| 128 | |
| 129 | /** |
| 130 | * Register a callback to be called when requested data is passed in the current |
| 131 | * background processing. |
| 132 | * |
| 133 | * @param owner owner of the background notification |
| 134 | * @param trace the trace computed |
| 135 | * @param notify_time time when notification hooks must be called |
| 136 | * @param notify_position position when notification hooks must be called |
| 137 | * @param notify Hook to call when the notify position is passed |
| 138 | */ |
| 139 | |
| 140 | void lttvwindowtraces_background_notify_current |
| 141 | (gpointer owner, |
| 142 | LttvTrace *trace, |
| 143 | LttTime notify_time, |
| 144 | const LttvTracesetContextPosition *notify_position, |
| 145 | const LttvHooks *notify); |
| 146 | |
| 147 | /** |
| 148 | * Removes all the notifications requests from a specific viewer. |
| 149 | * |
| 150 | * @param owner owner of the background notification |
| 151 | */ |
| 152 | |
| 153 | void lttvwindowtraces_background_notify_remove(gpointer owner); |
| 154 | |
| 155 | |
| 156 | #endif //LTTVWINDOWTRACES_H |