X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Finclude%2Fltt%2Ftrace.h;h=e96e73e4573c072bedecf16e5eacbd734d1a2703;hb=e969fd8ead1ce0d34c839d8598a24f3af768d42e;hp=0aa69f5ce61d53e15ae184c6331e4672417cf53b;hpb=1b82f325932b2d092d1e0ff33f58afd9ede44d72;p=lttv.git diff --git a/ltt/branches/poly/include/ltt/trace.h b/ltt/branches/poly/include/ltt/trace.h index 0aa69f5c..e96e73e4 100644 --- a/ltt/branches/poly/include/ltt/trace.h +++ b/ltt/branches/poly/include/ltt/trace.h @@ -1,100 +1,111 @@ -#ifndef TRACEFILE_H -#define TRACEFILE_H +#ifndef TRACE_H +#define TRACE_H #include /* A trace is specified as a pathname to the directory containing all the - associated data (control tracefile, per cpu tracefiles, event + associated data (control tracefiles, per cpu tracefiles, event descriptions...). When a trace is closed, all the associated facilities, types and fields are released as well. */ -ltt_trace *ltt_trace_open(char *pathname); +LttTrace *ltt_trace_open(char *pathname); -void ltt_trace_close(ltt_trace *t); +void ltt_trace_close(LttTrace *t); -/* A trace may be queried for its architecture type (e.g., "i386", - "powerpc", "powerpcle", "s390", "s390x"), its architecture variant - (e.g., "att" versus "sun" for m68k), its operating system (e.g., "linux", - "bsd"), its generic architecture, and the machine identity (e.g., system - host name). All character strings belong to the associated tracefile - and are freed when it is closed. */ +/* 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; +}; -char *ltt_tracefile_arch_type(ltt_trace *t); +LttSystemDescription *ltt_trace_system_description(LttTrace *t); -char *ltt_tracefile_arch_variant(ltt_trace *t); -char *ltt_tracefile_system_type(ltt_trace *t); +/* Functions to discover the facilities in the trace. Once the number + of facilities is known, they may be accessed by position. Multiple + versions of a facility (same name, different checksum) have consecutive + positions. */ -ltt_arch_size ltt_tracefile_arch_size(ltt_trace *t); +unsigned ltt_trace_facility_number(LttTrace *t); -ltt_arch_endian ltt_tracefile_arch_endian(ltt_trace *t); +LttFacility *ltt_trace_facility_get(LttTrace *t, unsigned i); -/* Hostname of the system where the trace was recorded */ +/* 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 + facility is unknown, returning 1, the named facility is at the specified + position, returning n, the facilities are from position to + position + n - 1. */ -char *ltt_trace_system_name(ltt_tracefile *t); +unsigned ltt_trace_facility_find(LttTrace *t, char *name, unsigned *position); -/* SMP multi-processors have 2 or more CPUs */ - -unsigned ltt_trace_cpu_number(ltt_trace *t); - - -/* Start and end time of the trace and its duration */ - -ltt_time ltt_tracefile_time_start(ltt_trace *t); - -ltt_time ltt_tracefile_time_end(ltt_trace *t); - -ltt_time ltt_tracefile_duration(ltt_tracefile *t); +/* Functions to discover all the event types in the trace */ +unsigned ltt_trace_eventtype_number(LttTrace *t); -/* Functions to discover the facilities in the trace */ +LttEventType *ltt_trace_eventtype_get(LttTrace *t, unsigned i); -unsigned ltt_trace_facility_number(ltt_trace *t); -ltt_facility *ltt_trace_facility_get(ltt_trace *t, unsigned i); +/* There is one "per cpu" tracefile for each CPU, numbered from 0 to + the maximum number of CPU in the system. When the number of CPU installed + is less than the maximum, some positions are unused. There are also a + number of "control" tracefiles (facilities, interrupts...). */ -ltt_facility *ltt_trace_facility_get_by_name(ltt_trace *t, char *name); +unsigned ltt_trace_control_tracefile_number(LttTrace *t); +unsigned ltt_trace_per_cpu_tracefile_number(LttTrace *t); -/* Functions to discover all the event types in the trace */ -unsigned ltt_trace_eventtype_number(ltt_tracefile *t); +/* It is possible to search for the tracefiles by name or by CPU position. + The index within the tracefiles of the same type is returned if found + and a negative value otherwise. */ -ltt_eventtype *ltt_trace_eventtype_get(ltt_tracefile *t, unsigned i); +int ltt_trace_control_tracefile_find(LttTrace *t, char *name); +int ltt_trace_per_cpu_tracefile_find(LttTrace *t, unsigned i); -/* A trace typically contains one "control" tracefile with important events - (for all CPUs), and one tracefile with ordinary events per cpu. - The tracefiles in a trace may be enumerated for each category - (all cpu and per cpu). The total number of tracefiles and of CPUs - may also be obtained. */ -unsigned int ltt_trace_tracefile_number(ltt_trace *t); +/* Get a specific tracefile */ -unsigned int ltt_trace_tracefile_number_per_cpu(ltt_trace *t); +LttTracefile *ltt_trace_control_tracefile_get(LttTrace *t, unsigned i); -unsigned int ltt_trace_tracefile_number_all_cpu(ltt_trace *t); +LttTracefile *ltt_trace_per_cpu_tracefile_get(LttTrace *t, unsigned i); -ltt_tracefile *ltt_trace_tracefile_get_per_cpu(ltt_trace *t, unsigned i); -ltt_tracefile *ltt_trace_tracefile_get_all_cpu(ltt_trace *t, unsigned i); +/* Get the name of a tracefile */ -char *ltt_tracefile_name(ltt_tracefile *tf); +char *ltt_tracefile_name(LttTracefile *tf); /* Seek to the first event of the trace with time larger or equal to time */ -int ltt_tracefile_seek_time(ltt_tracefile *t, ltt_time time); +void ltt_tracefile_seek_time(LttTracefile *t, LttTime time); /* Read the next event */ -ltt_event *ltt_tracefile_read(ltt_tracefile *t); +LttEvent *ltt_tracefile_read(LttTracefile *t); #endif // TRACE_H