From a5dcde2f975b43a9c6069c4a346528588bf1f8c8 Mon Sep 17 00:00:00 2001 From: yangxx Date: Tue, 11 Nov 2003 21:50:38 +0000 Subject: [PATCH] move ltt-private.h from public directroy into private directroy git-svn-id: http://ltt.polymtl.ca/svn@334 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/include/ltt/Makefile.am | 1 - ltt/branches/poly/include/ltt/event.h | 2 + ltt/branches/poly/include/ltt/facility.h | 2 + ltt/branches/poly/include/ltt/ltt.h | 5 +- ltt/branches/poly/include/ltt/trace.h | 67 ++++++++++++------- ltt/branches/poly/include/ltt/type.h | 7 +- ltt/branches/poly/ltt/Makefile.am | 2 +- ltt/branches/poly/ltt/event.c | 9 +++ ltt/branches/poly/ltt/facility.c | 2 + .../poly/{include => }/ltt/ltt-private.h | 49 +++++++------- ltt/branches/poly/ltt/tracefile.c | 34 ++++++++++ ltt/branches/poly/ltt/type.c | 7 ++ ltt/branches/poly/lttv/batchAnalysis.c | 1 + .../lttv/modules/gui/mainWin/src/callbacks.c | 3 +- .../modules/gui/mainWin/src/init_module.c | 2 + .../lttv/modules/gui/mainWin/src/lttvfilter.c | 1 + ltt/branches/poly/lttv/modules/guiEvents.c | 27 ++++---- .../lttv/modules/guiStatistic/guiStatistic.c | 3 +- ltt/branches/poly/lttv/processTrace.c | 2 + ltt/branches/poly/lttv/state.c | 9 +-- ltt/branches/poly/lttv/textDump.c | 11 +-- 21 files changed, 166 insertions(+), 80 deletions(-) rename ltt/branches/poly/{include => }/ltt/ltt-private.h (90%) diff --git a/ltt/branches/poly/include/ltt/Makefile.am b/ltt/branches/poly/include/ltt/Makefile.am index 70065316..2ffd9244 100644 --- a/ltt/branches/poly/include/ltt/Makefile.am +++ b/ltt/branches/poly/include/ltt/Makefile.am @@ -1,7 +1,6 @@ lttinclude_HEADERS = \ event.h\ facility.h\ - ltt-private.h\ ltt.h\ time.h\ trace.h\ diff --git a/ltt/branches/poly/include/ltt/event.h b/ltt/branches/poly/include/ltt/event.h index 1ba598df..7c231ccc 100644 --- a/ltt/branches/poly/include/ltt/event.h +++ b/ltt/branches/poly/include/ltt/event.h @@ -43,6 +43,8 @@ LttCycleCount ltt_event_cycle_count(LttEvent *e); void ltt_event_position(LttEvent *e, LttEventPosition *ep); +LttEventPosition * ltt_event_position_new(); + void ltt_event_position_get(LttEventPosition *ep, unsigned *block_number, unsigned *index_in_block, LttTracefile ** tf); diff --git a/ltt/branches/poly/include/ltt/facility.h b/ltt/branches/poly/include/ltt/facility.h index ae1dd9f1..4bca4fd1 100644 --- a/ltt/branches/poly/include/ltt/facility.h +++ b/ltt/branches/poly/include/ltt/facility.h @@ -11,6 +11,8 @@ char *ltt_facility_name(LttFacility *f); LttChecksum ltt_facility_checksum(LttFacility *f); +/* open facility */ +void ltt_facility_open(LttTrace * t, char * facility_name); /* Discover the event types within the facility. The event type integer id relative to the trace is from 0 to nb_event_types - 1. The event diff --git a/ltt/branches/poly/include/ltt/ltt.h b/ltt/branches/poly/include/ltt/ltt.h index 9e14dece..ed86a5db 100644 --- a/ltt/branches/poly/include/ltt/ltt.h +++ b/ltt/branches/poly/include/ltt/ltt.h @@ -106,7 +106,10 @@ typedef enum _LttArchEndian { LTT_LITTLE_ENDIAN, LTT_BIG_ENDIAN } LttArchEndian; -#include +typedef enum _LttTypeEnum +{ LTT_INT, LTT_UINT, LTT_FLOAT, LTT_STRING, LTT_ENUM, LTT_ARRAY, + LTT_SEQUENCE, LTT_STRUCT, LTT_UNION +} LttTypeEnum; #endif // LTT_H diff --git a/ltt/branches/poly/include/ltt/trace.h b/ltt/branches/poly/include/ltt/trace.h index 191422c6..284d4bab 100644 --- a/ltt/branches/poly/include/ltt/trace.h +++ b/ltt/branches/poly/include/ltt/trace.h @@ -20,30 +20,6 @@ char * ltt_trace_name(LttTrace *t); void ltt_trace_close(LttTrace *t); -/* The characteristics of the system on which the trace was obtained - is described in a LttSystemDescription structure. */ - -struct _LttSystemDescription { - char *description; - char *node_name; - char *domain_name; - unsigned nb_cpu; - LttArchSize size; - LttArchEndian endian; - char *kernel_name; - char *kernel_release; - char *kernel_version; - char *machine; - char *processor; - char *hardware_platform; - char *operating_system; - unsigned ltt_major_version; - unsigned ltt_minor_version; - unsigned ltt_block_size; - LttTime trace_start; - LttTime trace_end; -}; - LttSystemDescription *ltt_trace_system_description(LttTrace *t); @@ -56,6 +32,7 @@ unsigned ltt_trace_facility_number(LttTrace *t); LttFacility *ltt_trace_facility_get(LttTrace *t, unsigned i); +LttFacility * ltt_trace_facility_by_id(LttTrace * trace, unsigned id); /* Look for a facility by name. It returns the number of facilities found and sets the position argument to the first found. Returning 0, the named @@ -127,4 +104,46 @@ void ltt_tracefile_seek_position(LttTracefile *t, LttEvent *ltt_tracefile_read(LttTracefile *t); +/* open tracefile */ + +LttTracefile * ltt_tracefile_open(LttTrace *t, char * tracefile_name); + +void ltt_tracefile_open_cpu(LttTrace *t, char * tracefile_name); + +void ltt_tracefile_open_control(LttTrace *t, char * control_name); + + +/* obtain the time of an event */ + +LttTime getEventTime(LttTracefile * tf); + + +/* get the data type size and endian type of the local machine */ + +void getDataEndianType(LttArchSize * size, LttArchEndian * endian); + +/* get an integer number */ + +int getIntNumber(int size1, void *evD); + + +/* get the node name of the system */ + +char * ltt_trace_system_description_node_name (LttSystemDescription * s); + + +/* get the domain name of the system */ + +char * ltt_trace_system_description_domain_name (LttSystemDescription * s); + + +/* get the description of the system */ + +char * ltt_trace_system_description_description (LttSystemDescription * s); + + +/* get the start time of the trace */ + +LttTime ltt_trace_system_description_trace_start_time(LttSystemDescription *s); + #endif // TRACE_H diff --git a/ltt/branches/poly/include/ltt/type.h b/ltt/branches/poly/include/ltt/type.h index 3e567975..2d0655a9 100644 --- a/ltt/branches/poly/include/ltt/type.h +++ b/ltt/branches/poly/include/ltt/type.h @@ -4,11 +4,6 @@ /* Different types allowed */ -typedef enum _LttTypeEnum -{ LTT_INT, LTT_UINT, LTT_FLOAT, LTT_STRING, LTT_ENUM, LTT_ARRAY, - LTT_SEQUENCE, LTT_STRUCT, LTT_UNION -} LttTypeEnum; - #include @@ -84,4 +79,6 @@ LttField *ltt_field_member(LttField *f, unsigned i); LttType *ltt_field_type(LttField *f); +int ltt_field_size(LttField * f); + #endif // TYPE_H diff --git a/ltt/branches/poly/ltt/Makefile.am b/ltt/branches/poly/ltt/Makefile.am index c78c7406..92e4dcef 100644 --- a/ltt/branches/poly/ltt/Makefile.am +++ b/ltt/branches/poly/ltt/Makefile.am @@ -13,7 +13,7 @@ LIBS += $(GLIB_LIBS) lib_LTLIBRARIES = libtraceread.la libtraceread_la_SOURCES = event.c facility.c parser.c tracefile.c type.c -noinst_HEADERS = parser.h +noinst_HEADERS = parser.h ltt-private.h EXTRA_DIST = crc32.tab diff --git a/ltt/branches/poly/ltt/event.c b/ltt/branches/poly/ltt/event.c index 9b3ff0d9..8a3174cf 100644 --- a/ltt/branches/poly/ltt/event.c +++ b/ltt/branches/poly/ltt/event.c @@ -1,8 +1,12 @@ #include #include #include + #include "parser.h" +#include +#include "ltt-private.h" #include +#include /***************************************************************************** *Function name @@ -200,6 +204,11 @@ void ltt_event_position(LttEvent *e, LttEventPosition *ep) ep->tf = e->tracefile; } +LttEventPosition * ltt_event_position_new() +{ + return g_new(LttEventPosition, 1); +} + /***************************************************************************** *Function name * ltt_event_position_get : get the block number and index of the event diff --git a/ltt/branches/poly/ltt/facility.c b/ltt/branches/poly/ltt/facility.c index 6d70d572..6807ef0e 100644 --- a/ltt/branches/poly/ltt/facility.c +++ b/ltt/branches/poly/ltt/facility.c @@ -3,6 +3,8 @@ #include #include "parser.h" +#include +#include "ltt-private.h" #include /* search for the (named) type in the table, if it does not exist diff --git a/ltt/branches/poly/include/ltt/ltt-private.h b/ltt/branches/poly/ltt/ltt-private.h similarity index 90% rename from ltt/branches/poly/include/ltt/ltt-private.h rename to ltt/branches/poly/ltt/ltt-private.h index faf2baff..ea4dff8c 100644 --- a/ltt/branches/poly/include/ltt/ltt-private.h +++ b/ltt/branches/poly/ltt/ltt-private.h @@ -4,8 +4,6 @@ #include #include #include -#include -#include #define LTT_PACKED_STRUCT __attribute__ ((packed)) @@ -170,6 +168,30 @@ struct _LttEventPosition{ //being remembered }; +/* The characteristics of the system on which the trace was obtained + is described in a LttSystemDescription structure. */ + +struct _LttSystemDescription { + char *description; + char *node_name; + char *domain_name; + unsigned nb_cpu; + LttArchSize size; + LttArchEndian endian; + char *kernel_name; + char *kernel_release; + char *kernel_version; + char *machine; + char *processor; + char *hardware_platform; + char *operating_system; + unsigned ltt_major_version; + unsigned ltt_minor_version; + unsigned ltt_block_size; + LttTime trace_start; + LttTime trace_end; +}; + /***************************************************************************** macro for size of some data types *****************************************************************************/ @@ -178,27 +200,4 @@ struct _LttEventPosition{ #define EVENT_HEADER_SIZE (EVENT_ID_SIZE + TIME_DELTA_SIZE) - - -/* obtain the time of an event */ -LttTime getEventTime(LttTracefile * tf); - -/* get the data type size and endian type of the local machine */ -void getDataEndianType(LttArchSize * size, LttArchEndian * endian); - -/* get an integer number */ -int getIntNumber(int size1, void *evD); - -/* open facility */ -void ltt_facility_open(LttTrace * t, char * facility_name); - -/* get facility by event id */ -LttFacility * ltt_trace_facility_by_id(LttTrace * trace, unsigned id); - -/* open tracefile */ -LttTracefile * ltt_tracefile_open(LttTrace *t, char * tracefile_name); -void ltt_tracefile_open_cpu(LttTrace *t, char * tracefile_name); -void ltt_tracefile_open_control(LttTrace *t, char * control_name); - - #endif /* LTT_PRIVATE_H */ diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 3d213971..debf0327 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -6,7 +6,10 @@ #include #include "parser.h" +#include +#include "ltt-private.h" #include +#include #define DIR_NAME_SIZE 256 @@ -1384,3 +1387,34 @@ void getDataEndianType(LttArchSize * size, LttArchEndian * endian) else *size = LTT_UNKNOWN; } +/* get the node name of the system */ + +char * ltt_trace_system_description_node_name (LttSystemDescription * s) +{ + return s->node_name; +} + + +/* get the domain name of the system */ + +char * ltt_trace_system_description_domain_name (LttSystemDescription * s) +{ + return s->domain_name; +} + + +/* get the description of the system */ + +char * ltt_trace_system_description_description (LttSystemDescription * s) +{ + return s->description; +} + + +/* get the start time of the trace */ + +LttTime ltt_trace_system_description_trace_start_time(LttSystemDescription *s) +{ + return s->trace_start; +} + diff --git a/ltt/branches/poly/ltt/type.c b/ltt/branches/poly/ltt/type.c index be96a3c7..dc39d9d1 100644 --- a/ltt/branches/poly/ltt/type.c +++ b/ltt/branches/poly/ltt/type.c @@ -1,6 +1,8 @@ #include #include "parser.h" +#include +#include "ltt-private.h" #include static unsigned intSizes[] = { @@ -315,3 +317,8 @@ LttType *ltt_field_type(LttField *f) return f->field_type; } +int ltt_field_size(LttField * f) +{ + if(!f)return 0; + return f->field_size; +} diff --git a/ltt/branches/poly/lttv/batchAnalysis.c b/ltt/branches/poly/lttv/batchAnalysis.c index 98a686cd..62703429 100644 --- a/ltt/branches/poly/lttv/batchAnalysis.c +++ b/ltt/branches/poly/lttv/batchAnalysis.c @@ -10,6 +10,7 @@ #include #include #include +#include static LttvTraceset *traceset; diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c index df9aa693..fd708324 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c @@ -16,6 +16,7 @@ #include #include #include +#include #define PATH_LENGTH 256 #define DEFAULT_TIME_WIDTH_S 1 @@ -378,7 +379,7 @@ void remove_trace(GtkWidget * widget, gpointer user_data) trace_v = lttv_traceset_get(mw_data->current_tab-> traceset_info->traceset, i); trace = lttv_trace(trace_v); - name[i] = trace->pathname; + name[i] = ltt_trace_name(trace); } remove_trace_name = get_remove_trace(name, nb_trace); diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c index 1fe80b54..7bf2f5e3 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/init_module.c @@ -24,6 +24,8 @@ #include "support.h" #include #include "callbacks.h" +#include + /* global variable */ static WindowCreationData win_creation_data; diff --git a/ltt/branches/poly/lttv/modules/gui/mainWin/src/lttvfilter.c b/ltt/branches/poly/lttv/modules/gui/mainWin/src/lttvfilter.c index 24221569..ed5f9824 100644 --- a/ltt/branches/poly/lttv/modules/gui/mainWin/src/lttvfilter.c +++ b/ltt/branches/poly/lttv/modules/gui/mainWin/src/lttvfilter.c @@ -1,6 +1,7 @@ #include #include +#include struct _LttvTracesetSelector { char * traceset_name; diff --git a/ltt/branches/poly/lttv/modules/guiEvents.c b/ltt/branches/poly/lttv/modules/guiEvents.c index 94fc4a2d..a53f7262 100644 --- a/ltt/branches/poly/lttv/modules/guiEvents.c +++ b/ltt/branches/poly/lttv/modules/guiEvents.c @@ -67,7 +67,7 @@ typedef struct _RawTraceData{ int pid; unsigned entry_length; char * event_description; - LttEventPosition ep; + LttEventPosition *ep; } RawTraceData; #define RESERVE_BIG_SIZE 1000 @@ -835,20 +835,20 @@ void get_test_data(double time_value, guint list_height, raw_data = (RawTraceData*)g_list_nth_data(first,0); end = raw_data->time; end.tv_nsec--; - ltt_event_position_get(&raw_data->ep, &block_num, &event_num, &tf); + ltt_event_position_get(raw_data->ep, &block_num, &event_num, &tf); if(size !=0){ if(event_num > minNum){ backward_num = event_num > RESERVE_SMALL_SIZE ? event_num - RESERVE_SMALL_SIZE : 1; - ltt_event_position_set(&raw_data->ep, block_num, backward_num); - ltt_tracefile_seek_position(tf, &raw_data->ep); + ltt_event_position_set(raw_data->ep, block_num, backward_num); + ltt_tracefile_seek_position(tf, raw_data->ep); ev = ltt_tracefile_read(tf); start = ltt_event_time(ev); maxNum = G_MAXULONG; }else{ if(block_num > 1){ - ltt_event_position_set(&raw_data->ep, block_num-1, 1); - ltt_tracefile_seek_position(tf, &raw_data->ep); + ltt_event_position_set(raw_data->ep, block_num-1, 1); + ltt_tracefile_seek_position(tf, raw_data->ep); ev = ltt_tracefile_read(tf); start = ltt_event_time(ev); }else{ @@ -859,8 +859,8 @@ void get_test_data(double time_value, guint list_height, } }else{ if(block_num > count){ - ltt_event_position_set(&raw_data->ep, block_num-count, 1); - ltt_tracefile_seek_position(tf, &raw_data->ep); + ltt_event_position_set(raw_data->ep, block_num-count, 1); + ltt_tracefile_seek_position(tf, raw_data->ep); ev = ltt_tracefile_read(tf); start = ltt_event_time(ev); }else{ @@ -934,13 +934,13 @@ void get_test_data(double time_value, guint list_height, raw_data = (RawTraceData*)g_list_nth_data(first,0); end = raw_data->time; end.tv_nsec--; - ltt_event_position_get(&raw_data->ep, &block_num, &event_num, &tf); + ltt_event_position_get(raw_data->ep, &block_num, &event_num, &tf); if(event_num > list_height - size){ backward_num = event_num > RESERVE_SMALL_SIZE ? event_num - RESERVE_SMALL_SIZE : 1; - ltt_event_position_set(&raw_data->ep, block_num, backward_num); - ltt_tracefile_seek_position(tf, &raw_data->ep); + ltt_event_position_set(raw_data->ep, block_num, backward_num); + ltt_tracefile_seek_position(tf, raw_data->ep); ev = ltt_tracefile_read(tf); start = ltt_event_time(ev); maxNum = G_MAXULONG; @@ -1390,11 +1390,12 @@ gboolean parse_event(void *hook_data, void *call_data) tmp_raw_trace_data->cpu_id = ltt_event_cpu_id(e); tmp_raw_trace_data->event_name = g_strdup(ltt_eventtype_name(ltt_event_eventtype(e))); tmp_raw_trace_data->time = time; + tmp_raw_trace_data->ep = ltt_event_position_new(); if(prev_raw_trace_data) tmp_raw_trace_data->pid = prev_raw_trace_data->pid; else tmp_raw_trace_data->pid = -1; - tmp_raw_trace_data->entry_length = field == NULL ? 0 : field->field_size; + tmp_raw_trace_data->entry_length = field == NULL ? 0 : ltt_field_size(field); if(field) get_event_detail(e, field, detail_event); tmp_raw_trace_data->event_description = g_strdup(detail_event->str); @@ -1414,7 +1415,7 @@ gboolean parse_event(void *hook_data, void *call_data) } } - ltt_event_position(e, &tmp_raw_trace_data->ep); + ltt_event_position(e, tmp_raw_trace_data->ep); if(event_viewer_data->raw_trace_data_queue_tmp->length >= RESERVE_SMALL_SIZE){ if(event_viewer_data->append){ diff --git a/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c b/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c index 230cd842..31fece3d 100644 --- a/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c +++ b/ltt/branches/poly/lttv/modules/guiStatistic/guiStatistic.c @@ -377,7 +377,8 @@ void show_traceset_stats(StatisticViewerData * statistic_viewer_data) tcs = (LttvTraceStats *)(LTTV_TRACESET_CONTEXT(tscs)->traces[i]); desc = ltt_trace_system_description(tcs->parent.parent.t); sprintf(trace_str, "Trace on system %s at time %d secs", - desc->node_name,desc->trace_start.tv_sec); + ltt_trace_system_description_node_name(desc), + (ltt_trace_system_description_trace_start_time(desc)).tv_sec); gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_set (store, &iter,NAME_COLUMN,trace_str,-1); diff --git a/ltt/branches/poly/lttv/processTrace.c b/ltt/branches/poly/lttv/processTrace.c index 9eaa5e55..92c19758 100644 --- a/ltt/branches/poly/lttv/processTrace.c +++ b/ltt/branches/poly/lttv/processTrace.c @@ -2,6 +2,8 @@ #include #include #include +#include +#include void lttv_context_init(LttvTracesetContext *self, LttvTraceset *ts) { diff --git a/ltt/branches/poly/lttv/state.c b/ltt/branches/poly/lttv/state.c index 4176313c..a753b802 100644 --- a/ltt/branches/poly/lttv/state.c +++ b/ltt/branches/poly/lttv/state.c @@ -3,6 +3,7 @@ #include #include #include +#include LttvExecutionMode LTTV_STATE_MODE_UNKNOWN, @@ -257,7 +258,7 @@ static void state_save(LttvTraceState *self, LttvAttribute *container) LTTV_POINTER); if(tfcs->parent.e == NULL) *(value.v_pointer) = NULL; else { - ep = g_new(LttEventPosition, 1); + ep = ltt_event_position_new(); ltt_event_position(tfcs->parent.e, ep); *(value.v_pointer) = ep; } @@ -861,7 +862,7 @@ static gboolean block_end(void *hook_data, void *call_data) LttvTraceState *tcs = (LttvTraceState *)(tfcs->parent.t_context); - LttEventPosition ep; + LttEventPosition *ep = ltt_event_position_new(); guint nb_block, nb_event; @@ -871,9 +872,9 @@ static gboolean block_end(void *hook_data, void *call_data) LttvAttributeValue value; - ltt_event_position(tfcs->parent.e, &ep); + ltt_event_position(tfcs->parent.e, ep); - ltt_event_position_get(&ep, &nb_block, &nb_event, &tf); + ltt_event_position_get(ep, &nb_block, &nb_event, &tf); tcs->nb_event += nb_event - tfcs->saved_position; tfcs->saved_position = 0; if(tcs->nb_event >= tcs->save_interval) { diff --git a/ltt/branches/poly/lttv/textDump.c b/ltt/branches/poly/lttv/textDump.c index dbdd2536..3333823d 100644 --- a/ltt/branches/poly/lttv/textDump.c +++ b/ltt/branches/poly/lttv/textDump.c @@ -218,8 +218,9 @@ print_stats(FILE *fp, LttvTracesetStats *tscs) for(i = 0 ; i < nb ; i++) { tcs = (LttvTraceStats *)(LTTV_TRACESET_CONTEXT(tscs)->traces[i]); desc = ltt_trace_system_description(tcs->parent.parent.t); - fprintf(fp, "Trace on system %s at time %d secs:\n", desc->node_name, - desc->trace_start.tv_sec); + fprintf(fp, "Trace on system %s at time %d secs:\n", + ltt_trace_system_description_node_name(desc), + (ltt_trace_system_description_trace_start_time(desc)).tv_sec); saved_length = indent->len; g_string_append(indent, " "); print_tree(fp, indent, tcs->stats); @@ -279,8 +280,10 @@ static gboolean write_trace_header(void *hook_data, void *call_data) LttSystemDescription *system = ltt_trace_system_description(tc->t); - fprintf(a_file," Trace from %s in %s\n%s\n\n", system->node_name, - system->domain_name, system->description); + fprintf(a_file," Trace from %s in %s\n%s\n\n", + ltt_trace_system_description_node_name(system), + ltt_trace_system_description_domain_name(system), + ltt_trace_system_description_description(system)); return FALSE; } -- 2.34.1