From: compudj Date: Mon, 14 May 2007 20:04:12 +0000 (+0000) Subject: remove old branches X-Git-Tag: v0.12.20~970 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=794cea477c3e511a80901a71522030a7a10ce7a6;p=lttv.git remove old branches git-svn-id: http://ltt.polymtl.ca/svn@2519 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/attic-branches/yangxx/convert/LTTTypes.h b/ltt/attic-branches/yangxx/convert/LTTTypes.h new file mode 100644 index 00000000..e493f84b --- /dev/null +++ b/ltt/attic-branches/yangxx/convert/LTTTypes.h @@ -0,0 +1,142 @@ +/* + * LTTTypes.h + * + * Copyright (C) 2000 Karim Yaghmour (karym@opersys.com). + * + * This is distributed under GPL. + * + * Header for LTT-secific types. + * + * History : + * K.Y. 07/09/2001, Added David Schleef's architecture independent ltt_set_bit/ltt_clear_bit/ltt_test_bit + * JAL, 05/01/2001, Modified PPC bit manipulation functions for x86 compatibility. + * (andy_lowe@mvista.com) + * K.Y., 31/05/2000, Initial typing. + */ + +#ifndef __TRACE_TOOLKIT_TYPES_HEADER__ +#define __TRACE_TOOLKIT_TYPES_HEADER__ + +#include +#include + +#if defined(sun) + +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned int u_int32_t; +#ifdef _LP64 +typedef unsigned long u_int64_t; +#else /* _ILP32 */ +#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) +typedef unsigned long long u_int64_t; +#endif /* __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) */ +#endif /* _LP64 */ + +#endif /* defined(sun) */ + +extern __inline__ int ltt_set_bit(int nr, void * addr) +{ + unsigned char *p = addr; + unsigned char mask = 1 << (nr&7); + unsigned char old; + + p += nr>>3; + old = *p; + *p |= mask; + + return ((old & mask) != 0); +} + +extern __inline__ int ltt_clear_bit(int nr, void * addr) +{ + unsigned char *p = addr; + unsigned char mask = 1 << (nr&7); + unsigned char old; + + p += nr>>3; + old = *p; + *p &= ~mask; + + return ((old & mask) != 0); +} + +extern __inline__ int ltt_test_bit(int nr,void *addr) +{ + unsigned char *p = addr; + unsigned char mask = 1 << (nr&7); + + p += nr>>3; + + return ((*p & mask) != 0); +} + +/* Big-endian/little-endian conversion macros for cross-development. */ +#if TARGET_NATIVE +/* For native development, these conversion macros aren't needed. */ +#define BREV16(x) (x) +#define BREV32(x) (x) +#define BREV64(x) (x) +#define RFT8(db,x) (x) +#define RFT16(db,x) (x) +#define RFT32(db,x) (x) +#define RFT64(db,x) (x) + +/* Non-native development */ +#else + /* BREV16: byte-reverse a 16-bit integer */ +#define BREV16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8)) + /* BREV32: byte-reverse a 32-bit integer */ +#define BREV32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \ + | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) + /* BREV64: byte-reverse a 64-bit integer */ +#define BREV64(x) ((((x) & 0xff00000000000000) >> 56) \ + | (((x) & 0x00ff000000000000) >> 40) \ + | (((x) & 0x0000ff0000000000) >> 24) \ + | (((x) & 0x000000ff00000000) >> 8) \ + | (((x) & 0x00000000ff000000) << 8) \ + | (((x) & 0x0000000000ff0000) << 24) \ + | (((x) & 0x000000000000ff00) << 40) \ + | (((x) & 0x00000000000000ff) << 56)) + /* RFTn: Read From Trace + * Conditionally byte-reverse an 8-, 16-, 32-, or 64-bit integer + * based on the value of the ByteRev member of the trace database + * structure pointer passed as the first argument.. + */ +#define RFT8(db,x) (x) +#define RFT16(db,x) ((db)->ByteRev ? BREV16(x) : (x)) +#define RFT32(db,x) ((db)->ByteRev ? BREV32(x) : (x)) +#define RFT64(db,x) ((db)->ByteRev ? BREV64(x) : (x)) +#endif /* TRACE_TARGET_NATIVE */ + +#if !defined(sun) +/* Some type corrections, just in case */ +#ifndef uint8_t +#define uint8_t u_int8_t +#endif +#ifndef uint16_t +#define uint16_t u_int16_t +#endif +#ifndef uint32_t +#define uint32_t u_int32_t +#endif +#ifndef uint64_t +#define uint64_t u_int64_t +#endif +#endif /* !defined(sun) */ + +/* Structure packing */ +#if LTT_UNPACKED_STRUCTS +#define LTT_PACKED_STRUCT +#else +#define LTT_PACKED_STRUCT __attribute__ ((packed)) +#endif /* UNPACKED_STRUCTS */ + +/* Trace mask */ +typedef uint64_t trace_event_mask; + +/* Boolean stuff */ +//#define TRUE 1 +//#define FALSE 0 + +#endif /* __TRACE_TOOLKIT_TYPES_HEADER__ */ diff --git a/ltt/attic-branches/yangxx/convert/LinuxEvents.h b/ltt/attic-branches/yangxx/convert/LinuxEvents.h new file mode 100644 index 00000000..7496fa77 --- /dev/null +++ b/ltt/attic-branches/yangxx/convert/LinuxEvents.h @@ -0,0 +1,302 @@ +/* + * LinuxEvents.h + * + * Copyright (C) 2000, 2001, 2002 Karim Yaghmour (karym@opersys.com). + * + * This header is distributed under GPL. + * + * Linux events being traced. + * + * History : + * K.Y., 31/05/1999, Initial typing. + * + */ + +#ifndef __TRACE_TOOLKIT_LINUX_HEADER__ +#define __TRACE_TOOLKIT_LINUX_HEADER__ + +#include + +/* Traced events */ +#define TRACE_START 0 /* This is to mark the trace's start */ +#define TRACE_SYSCALL_ENTRY 1 /* Entry in a given system call */ +#define TRACE_SYSCALL_EXIT 2 /* Exit from a given system call */ +#define TRACE_TRAP_ENTRY 3 /* Entry in a trap */ +#define TRACE_TRAP_EXIT 4 /* Exit from a trap */ +#define TRACE_IRQ_ENTRY 5 /* Entry in an irq */ +#define TRACE_IRQ_EXIT 6 /* Exit from an irq */ +#define TRACE_SCHEDCHANGE 7 /* Scheduling change */ +#define TRACE_KERNEL_TIMER 8 /* The kernel timer routine has been called */ +#define TRACE_SOFT_IRQ 9 /* Hit key part of soft-irq management */ +#define TRACE_PROCESS 10 /* Hit key part of process management */ +#define TRACE_FILE_SYSTEM 11 /* Hit key part of file system */ +#define TRACE_TIMER 12 /* Hit key part of timer management */ +#define TRACE_MEMORY 13 /* Hit key part of memory management */ +#define TRACE_SOCKET 14 /* Hit key part of socket communication */ +#define TRACE_IPC 15 /* Hit key part of inter-process communication */ +#define TRACE_NETWORK 16 /* Hit key part of network communication */ + +#define TRACE_BUFFER_START 17 /* Mark the begining of a trace buffer */ +#define TRACE_BUFFER_END 18 /* Mark the ending of a trace buffer */ +#define TRACE_NEW_EVENT 19 /* New event type */ +#define TRACE_CUSTOM 20 /* Custom event */ + +#define TRACE_CHANGE_MASK 21 /* Change in event mask */ +#define TRACE_HEARTBEAT 22 /* Heartbeat event */ + +/* Number of traced events */ +#define TRACE_MAX TRACE_HEARTBEAT + +/* Architecture types */ +#define TRACE_ARCH_TYPE_I386 1 /* i386 system */ +#define TRACE_ARCH_TYPE_PPC 2 /* PPC system */ +#define TRACE_ARCH_TYPE_SH 3 /* SH system */ +#define TRACE_ARCH_TYPE_S390 4 /* S/390 system */ +#define TRACE_ARCH_TYPE_MIPS 5 /* MIPS system */ +#define TRACE_ARCH_TYPE_ARM 6 /* ARM system */ + +/* Standard definitions for variants */ +#define TRACE_ARCH_VARIANT_NONE 0 /* Main architecture implementation */ + +/* PowerPC variants */ +#define TRACE_ARCH_VARIANT_PPC_4xx 1 /* 4xx systems (IBM embedded series) */ +#define TRACE_ARCH_VARIANT_PPC_6xx 2 /* 6xx/7xx/74xx/8260/POWER3 systems (desktop flavor) */ +#define TRACE_ARCH_VARIANT_PPC_8xx 3 /* 8xx system (Motoral embedded series) */ +#define TRACE_ARCH_VARIANT_PPC_ISERIES 4 /* 8xx system (iSeries) */ + +/* System types */ +#define TRACE_SYS_TYPE_VANILLA_LINUX 1 /* Vanilla linux kernel */ +#define TRACE_SYS_TYPE_RTAI_LINUX 2 /* RTAI patched linux kernel */ + +/* The information logged when the tracing is started */ +#define TRACER_MAGIC_NUMBER 0x00D6B7ED /* That day marks an important historical event ... */ +#define TRACER_SUP_VERSION_MAJOR 2 /* Major version number */ +#define TRACER_SUP_VERSION_MINOR 2 /* Minor version number */ +typedef struct _trace_start +{ + uint32_t MagicNumber; /* Magic number to identify a trace */ + uint32_t ArchType; /* Type of architecture */ + uint32_t ArchVariant; /* Variant of the given type of architecture */ + uint32_t SystemType; /* Operating system type */ + uint8_t MajorVersion; /* Major version of trace */ + uint8_t MinorVersion; /* Minor version of trace */ + + uint32_t BufferSize; /* Size of buffers */ + trace_event_mask EventMask; /* The event mask */ + trace_event_mask DetailsMask; /* Are the event details logged */ + uint8_t LogCPUID; /* Is the CPUID logged */ + uint8_t UseTSC; /* Are we using TSCs or time deltas */ + +} LTT_PACKED_STRUCT trace_start; +#define START_EVENT(X) ((trace_start*)X) + +/* TRACE_SYSCALL_ENTRY */ +typedef struct _trace_syscall_entry +{ + uint8_t syscall_id; /* Syscall entry number in entry.S */ + uint32_t address; /* Address from which call was made */ +} LTT_PACKED_STRUCT trace_syscall_entry; +#define SYSCALL_EVENT(X) ((trace_syscall_entry*)X) + +/* TRACE_TRAP_ENTRY */ +typedef struct _trace_trap_entry +{ + uint16_t trap_id; /* Trap number */ + uint32_t address; /* Address where trap occured */ +} LTT_PACKED_STRUCT trace_trap_entry; +typedef struct _trace_trap_entry_s390 +{ + uint64_t trap_id; /* Trap number */ + uint32_t address; /* Address where trap occured */ +} LTT_PACKED_STRUCT trace_trap_entry_s390; +#define TRAP_EVENT(X) ((trace_trap_entry*)X) +#define TRAP_EVENT_S390(X) ((trace_trap_entry_s390*)X) + +/* TRACE_IRQ_ENTRY */ +typedef struct _trace_irq_entry +{ + uint8_t irq_id; /* IRQ number */ + uint8_t kernel; /* Are we executing kernel code */ +} LTT_PACKED_STRUCT trace_irq_entry; +#define IRQ_EVENT(X) ((trace_irq_entry*)X) + +/* TRACE_SCHEDCHANGE */ +typedef struct _trace_schedchange +{ + uint32_t out; /* Outgoing process */ + uint32_t in; /* Incoming process */ + uint32_t out_state; /* Outgoing process' state */ +} LTT_PACKED_STRUCT trace_schedchange; +#define SCHED_EVENT(X) ((trace_schedchange*)X) + +/* TRACE_SOFT_IRQ */ +#define TRACE_SOFT_IRQ_BOTTOM_HALF 1 /* Conventional bottom-half */ +#define TRACE_SOFT_IRQ_SOFT_IRQ 2 /* Real soft-irq */ +#define TRACE_SOFT_IRQ_TASKLET_ACTION 3 /* Tasklet action */ +#define TRACE_SOFT_IRQ_TASKLET_HI_ACTION 4 /* Tasklet hi-action */ +typedef struct _trace_soft_irq +{ + uint8_t event_sub_id; /* Soft-irq event Id */ + uint32_t event_data; /* Data associated with event */ +} LTT_PACKED_STRUCT trace_soft_irq; +#define SOFT_IRQ_EVENT(X) ((trace_soft_irq*)X) + +/* TRACE_PROCESS */ +#define TRACE_PROCESS_KTHREAD 1 /* Creation of a kernel thread */ +#define TRACE_PROCESS_FORK 2 /* A fork or clone occured */ +#define TRACE_PROCESS_EXIT 3 /* An exit occured */ +#define TRACE_PROCESS_WAIT 4 /* A wait occured */ +#define TRACE_PROCESS_SIGNAL 5 /* A signal has been sent */ +#define TRACE_PROCESS_WAKEUP 6 /* Wake up a process */ +typedef struct _trace_process +{ + uint8_t event_sub_id; /* Process event ID */ + uint32_t event_data1; /* Data associated with event */ + uint32_t event_data2; +} LTT_PACKED_STRUCT trace_process; +#define PROC_EVENT(X) ((trace_process*)X) + +/* TRACE_FILE_SYSTEM */ +#define TRACE_FILE_SYSTEM_BUF_WAIT_START 1 /* Starting to wait for a data buffer */ +#define TRACE_FILE_SYSTEM_BUF_WAIT_END 2 /* End to wait for a data buffer */ +#define TRACE_FILE_SYSTEM_EXEC 3 /* An exec occured */ +#define TRACE_FILE_SYSTEM_OPEN 4 /* An open occured */ +#define TRACE_FILE_SYSTEM_CLOSE 5 /* A close occured */ +#define TRACE_FILE_SYSTEM_READ 6 /* A read occured */ +#define TRACE_FILE_SYSTEM_WRITE 7 /* A write occured */ +#define TRACE_FILE_SYSTEM_SEEK 8 /* A seek occured */ +#define TRACE_FILE_SYSTEM_IOCTL 9 /* An ioctl occured */ +#define TRACE_FILE_SYSTEM_SELECT 10 /* A select occured */ +#define TRACE_FILE_SYSTEM_POLL 11 /* A poll occured */ +typedef struct _trace_file_system +{ + uint8_t event_sub_id; /* File system event ID */ + uint32_t event_data1; /* Event data */ + uint32_t event_data2; /* Event data 2 */ + char* file_name; /* Name of file operated on */ +} LTT_PACKED_STRUCT trace_file_system; +#define FS_EVENT(X) ((trace_file_system*)X) +#define FS_EVENT_FILENAME(X) ((char*) ((X) + sizeof(trace_file_system))) + +/* TRACE_TIMER */ +#define TRACE_TIMER_EXPIRED 1 /* Timer expired */ +#define TRACE_TIMER_SETITIMER 2 /* Setting itimer occurred */ +#define TRACE_TIMER_SETTIMEOUT 3 /* Setting sched timeout occurred */ +typedef struct _trace_timer +{ + uint8_t event_sub_id; /* Timer event ID */ + uint8_t event_sdata; /* Short data */ + uint32_t event_data1; /* Data associated with event */ + uint32_t event_data2; +} LTT_PACKED_STRUCT trace_timer; +#define TIMER_EVENT(X) ((trace_timer*)X) + +/* TRACE_MEMORY */ +#define TRACE_MEMORY_PAGE_ALLOC 1 /* Allocating pages */ +#define TRACE_MEMORY_PAGE_FREE 2 /* Freing pages */ +#define TRACE_MEMORY_SWAP_IN 3 /* Swaping pages in */ +#define TRACE_MEMORY_SWAP_OUT 4 /* Swaping pages out */ +#define TRACE_MEMORY_PAGE_WAIT_START 5 /* Start to wait for page */ +#define TRACE_MEMORY_PAGE_WAIT_END 6 /* End to wait for page */ +typedef struct _trace_memory +{ + uint8_t event_sub_id; /* Memory event ID */ + unsigned long event_data; /* Data associated with event */ +} LTT_PACKED_STRUCT trace_memory; +#define MEM_EVENT(X) ((trace_memory*)X) + +/* TRACE_SOCKET */ +#define TRACE_SOCKET_CALL 1 /* A socket call occured */ +#define TRACE_SOCKET_CREATE 2 /* A socket has been created */ +#define TRACE_SOCKET_SEND 3 /* Data was sent to a socket */ +#define TRACE_SOCKET_RECEIVE 4 /* Data was read from a socket */ +typedef struct _trace_socket +{ + uint8_t event_sub_id; /* Socket event ID */ + uint32_t event_data1; /* Data associated with event */ + uint32_t event_data2; /* Data associated with event */ +} LTT_PACKED_STRUCT trace_socket; +#define SOCKET_EVENT(X) ((trace_socket*)X) + +/* TRACE_IPC */ +#define TRACE_IPC_CALL 1 /* A System V IPC call occured */ +#define TRACE_IPC_MSG_CREATE 2 /* A message queue has been created */ +#define TRACE_IPC_SEM_CREATE 3 /* A semaphore was created */ +#define TRACE_IPC_SHM_CREATE 4 /* A shared memory segment has been created */ +typedef struct _trace_ipc +{ + uint8_t event_sub_id; /* IPC event ID */ + uint32_t event_data1; /* Data associated with event */ + uint32_t event_data2; /* Data associated with event */ +} LTT_PACKED_STRUCT trace_ipc; +#define IPC_EVENT(X) ((trace_ipc*)X) + +/* TRACE_NETWORK */ +#define TRACE_NETWORK_PACKET_IN 1 /* A packet came in */ +#define TRACE_NETWORK_PACKET_OUT 2 /* A packet was sent */ +typedef struct _trace_network +{ + uint8_t event_sub_id; /* Network event ID */ + uint32_t event_data; /* Event data */ +} LTT_PACKED_STRUCT trace_network; +#define NET_EVENT(X) ((trace_network*)X) + +/* Start of trace buffer information */ +typedef struct _trace_buffer_start +{ + struct timeval Time; /* Time stamp of this buffer */ + uint32_t TSC; /* TSC of this buffer, if applicable */ + uint32_t ID; /* Unique buffer ID */ +} LTT_PACKED_STRUCT trace_buffer_start; + +/* End of trace buffer information */ +typedef struct _trace_buffer_end +{ + struct timeval Time; /* Time stamp of this buffer */ + uint32_t TSC; /* TSC of this buffer, if applicable */ +} LTT_PACKED_STRUCT trace_buffer_end; + +/* Maximal size a custom event can have */ +#define CUSTOM_EVENT_MAX_SIZE 8192 + +/* String length limits for custom events creation */ +#define CUSTOM_EVENT_TYPE_STR_LEN 20 +#define CUSTOM_EVENT_DESC_STR_LEN 100 +#define CUSTOM_EVENT_FORM_STR_LEN 256 + +/* Type of custom event formats */ +#define CUSTOM_EVENT_FORMAT_TYPE_NONE 0 +#define CUSTOM_EVENT_FORMAT_TYPE_STR 1 +#define CUSTOM_EVENT_FORMAT_TYPE_HEX 2 +#define CUSTOM_EVENT_FORMAT_TYPE_XML 3 +#define CUSTOM_EVENT_FORMAT_TYPE_IBM 4 + +typedef struct _trace_new_event +{ + /* Basics */ + uint32_t id; /* Custom event ID */ + char type[CUSTOM_EVENT_TYPE_STR_LEN]; /* Event type description */ + char desc[CUSTOM_EVENT_DESC_STR_LEN]; /* Detailed event description */ + + /* Custom formatting */ + uint32_t format_type; /* Type of formatting */ + char form[CUSTOM_EVENT_FORM_STR_LEN]; /* Data specific to format */ +} LTT_PACKED_STRUCT trace_new_event; +#define NEW_EVENT(X) ((trace_new_event*) X) + +typedef struct _trace_custom +{ + uint32_t id; /* Event ID */ + uint32_t data_size; /* Size of data recorded by event */ + void* data; /* Data recorded by event */ +} LTT_PACKED_STRUCT trace_custom; +#define CUSTOM_EVENT(X) ((trace_custom*) X) + +/* TRACE_CHANGE_MASK */ +typedef struct _trace_change_mask +{ + trace_event_mask mask; /* Event mask */ +} LTT_PACKED_STRUCT trace_change_mask; +#define CHMASK_EVENT(X) ((trace_change_mask*) X) + +#endif /* __TRACE_TOOLKIT_LINUX_HEADER__ */ diff --git a/ltt/attic-branches/yangxx/convert/Makefile b/ltt/attic-branches/yangxx/convert/Makefile new file mode 100644 index 00000000..e70473a9 --- /dev/null +++ b/ltt/attic-branches/yangxx/convert/Makefile @@ -0,0 +1,27 @@ +CC=gcc +CFLAGS=-g -o +CMPFLAGS=-g -c +INCLUDEPATH=-Iinclude + +#GLIB_CFLAGS = -I/usr/include/glib-1.2 -I/usr/lib/glib/include +GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include +#GLIB_CFLAGS = -I/usr/include/glib-2.0 + +GLIB_CONFIG = /usr/bin/glib-config +GLIB_LIBS = -L/usr/lib -lglib + +OBJ= convert.o + + +test: $(OBJ) + $(CC) $(CFLAGS) test $(OBJ) $(GLIB_LIBS) + +convert.o: convert.c + $(CC) $(INCLUDEPATH) $(GLIB_CFLAGS) $(CMPFLAGS) convert.c + + + +clean: + rm -rf *.o *~ *# + + diff --git a/ltt/attic-branches/yangxx/convert/convert.c b/ltt/attic-branches/yangxx/convert/convert.c new file mode 100644 index 00000000..2b79d5d5 --- /dev/null +++ b/ltt/attic-branches/yangxx/convert/convert.c @@ -0,0 +1,604 @@ +#include +#include +#include +#include +#include + +#include +#include "LTTTypes.h" +#include "LinuxEvents.h" + +#define write_to_buffer(DEST, SRC, SIZE) \ +do\ +{\ + memcpy(DEST, SRC, SIZE);\ + DEST += SIZE;\ +} while(0); + +int readFile(int fd, void * buf, size_t size, char * mesg) +{ + ssize_t nbBytes; + nbBytes = read(fd, buf, size); + if(nbBytes != size){ + printf("%s\n",mesg); + exit(1); + } + return 0; +} + +void getDataEndianType(char * size, char * endian) +{ + int i = 1; + char c = (char) i; + int sizeInt=sizeof(int), sizeLong=sizeof(long), sizePointer=sizeof(void *); + + if(c == 1) strcpy(endian,"LITTLE_ENDIAN"); + else strcpy(endian, "BIG_ENDIAN"); + + if(sizeInt == 2 && sizeLong == 4 && sizePointer == 4) + strcpy(size,"LP32"); + else if(sizeInt == 4 && sizeLong == 4 && sizePointer == 4) + strcpy(size,"ILP32"); + else if(sizeInt == 4 && sizeLong == 8 && sizePointer == 8) + strcpy(size,"LP64"); + else if(sizeInt == 8 && sizeLong == 8 && sizePointer == 8) + strcpy(size,"ILP64"); + else strcpy(size,"UNKNOWN"); +} + +#define BUFFER_SIZE 80 + +typedef struct _buffer_start{ + uint32_t seconds; + uint32_t nanoseconds; + uint64_t cycle_count; + uint32_t block_id; +} __attribute__ ((packed)) buffer_start; + +typedef struct _heartbeat{ + uint32_t seconds; + uint32_t nanoseconds; + uint64_t cycle_count; +} __attribute__ ((packed)) heartbeat; + + +int main(int argc, char ** argv){ + + int fd, *fdCpu; + FILE * fp; + int fdFac, fdIntr, fdProc; + char arch_size[BUFFER_SIZE]; + char endian[BUFFER_SIZE]; + char node_name[BUFFER_SIZE]; + char domainname[BUFFER_SIZE]; + char kernel_name[BUFFER_SIZE]; + char kernel_release[BUFFER_SIZE]; + char kernel_version[BUFFER_SIZE]; + char machine[BUFFER_SIZE]; + char processor[BUFFER_SIZE]; + char hardware_platform[BUFFER_SIZE]; + char operating_system[BUFFER_SIZE]; + int cpu; + int ltt_block_size; + int ltt_major_version; + int ltt_minor_version; + int ltt_log_cpu; + char buf[BUFFER_SIZE]; + int i,j; + + uint8_t cpu_id; + + char foo[4*BUFFER_SIZE]; + char foo_eventdefs[4*BUFFER_SIZE]; + char foo_control[4*BUFFER_SIZE]; + char foo_cpu[4*BUFFER_SIZE]; + char foo_info[4*BUFFER_SIZE]; + + char foo_control_facilities[4*BUFFER_SIZE]; + char foo_control_processes[4*BUFFER_SIZE]; + char foo_control_interrupts[4*BUFFER_SIZE]; + char foo_info_system[4*BUFFER_SIZE]; + + struct stat lTDFStat; + off_t file_size; + int block_number, block_size; + char * buffer, **buf_out, cpuStr[4*BUFFER_SIZE]; + char * buf_fac, * buf_intr, * buf_proc; + void ** write_pos, *write_pos_fac, * write_pos_intr, *write_pos_proc; + trace_start *tStart; + trace_buffer_start *tBufStart; + trace_buffer_end *tBufEnd; + trace_file_system * tFileSys; + uint16_t newId, startId; + uint8_t evId; + uint32_t time_delta, startTimeDelta; + void * cur_pos, *end_pos; + buffer_start start; + buffer_start end; + heartbeat beat; + int beat_count = 0; + gboolean * has_event; + uint32_t size_lost; + int reserve_size = sizeof(buffer_start) + sizeof(uint16_t) + 2*sizeof(uint32_t);//lost_size and buffer_end event + + if(argc != 3 && argc != 4){ + printf("need a trace file and cpu number or root directory for the new tracefile\n"); + exit(1); + } + + if(argc == 3){ + strcpy(foo, "foo"); + strcpy(foo_eventdefs, "foo/eventdefs"); + strcpy(foo_control, "foo/control"); + strcpy(foo_cpu, "foo/cpu"); + strcpy(foo_info, "foo/info"); + }else{ + strcpy(foo, argv[3]); + strcpy(foo_eventdefs, argv[3]); + strcat(foo_eventdefs,"/eventdefs"); + strcpy(foo_control, argv[3]); + strcat(foo_control,"/control"); + strcpy(foo_cpu, argv[3]); + strcat(foo_cpu,"/cpu"); + strcpy(foo_info, argv[3]); + strcat(foo_info,"/info"); + } + strcpy(foo_control_facilities, foo_control); + strcat(foo_control_facilities,"/facilities"); + strcpy(foo_control_processes, foo_control); + strcat(foo_control_processes, "/processes"); + strcpy(foo_control_interrupts, foo_control); + strcat(foo_control_interrupts, "/interrupts"); + strcpy(foo_info_system, foo_info); + strcat(foo_info_system, "/system.xml"); + + cpu = atoi(argv[2]); + printf("cpu number = %d\n", cpu); + + + getDataEndianType(arch_size, endian); + printf("Arch_size: %s, Endian: %s\n", arch_size, endian); + + fp = fopen("sysInfo.out","r"); + if(!fp){ + g_error("Unable to open file sysInfo.out\n"); + } + + for(i=0;i<9;i++){ + if(!fgets(buf,BUFFER_SIZE-1,fp)) + g_error("The format of sysInfo.out is not right\n"); + if(strncmp(buf,"node_name=",10)==0){ + strcpy(node_name,&buf[10]); + node_name[strlen(node_name)-1] = '\0'; + }else if(strncmp(buf,"domainname=",11)==0){ + strcpy(domainname,&buf[11]); + domainname[strlen(domainname)-1] = '\0'; + }else if(strncmp(buf,"kernel_name=",12)==0){ + strcpy(kernel_name,&buf[12]); + kernel_name[strlen(kernel_name)-1] = '\0'; + }else if(strncmp(buf,"kernel_release=",15)==0){ + strcpy(kernel_release,&buf[15]); + kernel_release[strlen(kernel_release)-1] = '\0'; + }else if(strncmp(buf,"kernel_version=",15)==0){ + strcpy(kernel_version,&buf[15]); + kernel_version[strlen(kernel_version)-1] = '\0'; + }else if(strncmp(buf,"machine=",8)==0){ + strcpy(machine,&buf[8]); + machine[strlen(machine)-1] = '\0'; + }else if(strncmp(buf,"processor=",10)==0){ + strcpy(processor,&buf[10]); + processor[strlen(processor)-1] = '\0'; + }else if(strncmp(buf,"hardware_platform=",18)==0){ + strcpy(hardware_platform,&buf[18]); + hardware_platform[strlen(hardware_platform)-1] = '\0'; + }else if(strncmp(buf,"operating_system=",17)==0){ + strcpy(operating_system,&buf[17]); + operating_system[strlen(operating_system)-1] = '\0'; + } + } + fclose(fp); + + if(mkdir(foo, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) + g_error("can not make %s directory", foo); + if(mkdir(foo_info, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) + g_error("can not make %s directory", foo_info); + if(mkdir(foo_cpu, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) + g_error("can not make %s directory", foo_cpu); + if(mkdir(foo_control, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) + g_error("can not make %s directory", foo_control); + if(mkdir(foo_eventdefs, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) + g_error("can not make %s directory", foo_eventdefs); + + fp = fopen(foo_info_system,"w"); + if(!fp){ + g_error("Unable to open file system.xml\n"); + } + + fd = open(argv[1], O_RDONLY, 0); + if(fd < 0){ + g_error("Unable to open input data file %s\n", argv[1]); + } + + fdFac = open(foo_control_facilities,O_CREAT | O_RDWR | O_TRUNC,S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); + if(fdFac < 0){ + g_error("Unable to open file facilities\n"); + } + fdIntr = open(foo_control_interrupts,O_CREAT | O_RDWR | O_TRUNC,S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); + if(fdIntr<0){ + g_error("Unable to open file interrupts\n"); + } + fdProc = open(foo_control_processes,O_CREAT | O_RDWR | O_TRUNC,S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); + if(fdIntr<0){ + g_error("Unable to open file process\n"); + } + + + + if(fstat(fd, &lTDFStat) < 0){ + g_error("Unable to get the status of the input data file\n"); + } + file_size = lTDFStat.st_size; + + buffer = g_new(char, 4000); + readFile(fd,(void*)buffer, 3500, "Unable to read block header"); + + cur_pos= buffer; + evId = *(uint8_t *)cur_pos; + cur_pos += sizeof(uint8_t); + newId = evId; + time_delta = *(uint32_t*)cur_pos; + cur_pos += sizeof(uint32_t); + tBufStart = (trace_buffer_start*)cur_pos; + cur_pos += sizeof(trace_buffer_start); + cur_pos += sizeof(uint16_t); //Skip event size + + evId = *(uint8_t *)cur_pos; + cur_pos += sizeof(uint8_t); + cur_pos += sizeof(uint32_t); + tStart = (trace_start*)cur_pos; + + startId = newId; + startTimeDelta = time_delta; + start.seconds = tBufStart->Time.tv_sec; + start.nanoseconds = tBufStart->Time.tv_usec; + start.cycle_count = tBufStart->TSC; + start.block_id = tBufStart->ID; + end.block_id = start.block_id; + + ltt_major_version = tStart->MajorVersion; + ltt_minor_version = tStart->MinorVersion; + ltt_block_size = tStart->BufferSize; + ltt_log_cpu = tStart->LogCPUID; + + block_size = ltt_block_size; + block_number = file_size/block_size; + + g_free(buffer); + buffer = g_new(char, block_size); + buf_fac = g_new(char, block_size); + write_pos_fac = buf_fac; + buf_intr = g_new(char, block_size); + write_pos_intr = buf_intr; + buf_proc = g_new(char, block_size); + write_pos_proc = buf_proc; + + buf_out = g_new(char*,cpu); + write_pos = g_new(void*, cpu); + fdCpu = g_new(int, cpu); + has_event = g_new(gboolean, cpu); + for(i=0;iTime.tv_sec; + start.nanoseconds = tBufStart->Time.tv_usec; + start.cycle_count = tBufStart->TSC; + start.block_id = tBufStart->ID; + end.block_id = start.block_id; + + end_pos = buffer + block_size; //end of the buffer + size_lost = *(uint32_t*)(end_pos - sizeof(uint32_t)); + + end_pos = buffer + block_size - size_lost ; //buffer_end event + if(ltt_log_cpu){ + tBufEnd = (trace_buffer_end*)(end_pos + 2 * sizeof(uint8_t)+sizeof(uint32_t)); + }else{ + tBufEnd = (trace_buffer_end*)(end_pos+sizeof(uint8_t)+sizeof(uint32_t)); + } + end.seconds = tBufEnd->Time.tv_sec; + end.nanoseconds = tBufEnd->Time.tv_usec; + end.cycle_count = tBufEnd->TSC; + + //skip buffer start and trace start events + if(i==0) //the first block + cur_pos = buffer + sizeof(trace_buffer_start) + sizeof(trace_start) + 2*(sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint32_t)); + else //other blocks + cur_pos = buffer + sizeof(trace_buffer_start) + sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint32_t); + + //for cpu 0, always make records + write_to_buffer(write_pos[0],(void*)&startId, sizeof(uint16_t)); + write_to_buffer(write_pos[0],(void*)&startTimeDelta, sizeof(uint32_t)); + write_to_buffer(write_pos[0],(void*)&start, sizeof(buffer_start)); + + //write start block event into processes and interrupts files + write_to_buffer(write_pos_intr,(void*)&startId, sizeof(uint16_t)); + write_to_buffer(write_pos_intr,(void*)&startTimeDelta, sizeof(uint32_t)); + write_to_buffer(write_pos_intr,(void*)&start, sizeof(buffer_start)); + write_to_buffer(write_pos_proc,(void*)&startId, sizeof(uint16_t)); + write_to_buffer(write_pos_proc,(void*)&startTimeDelta, sizeof(uint32_t)); + write_to_buffer(write_pos_proc,(void*)&start, sizeof(buffer_start)); + + while(1){ + int event_size; + uint64_t timeDelta; + uint8_t subId; + + if(ltt_log_cpu){ + cpu_id = *(uint8_t*)cur_pos; + cur_pos += sizeof(uint8_t); + if(cpu_id != 0 && has_event[cpu_id] == FALSE){ + has_event[cpu_id] = TRUE; + write_to_buffer(write_pos[cpu_id],(void*)&startId,sizeof(uint16_t)); + write_to_buffer(write_pos[cpu_id],(void*)&startTimeDelta, sizeof(uint32_t)); + write_to_buffer(write_pos[cpu_id],(void*)&start, sizeof(buffer_start)); + } + } + evId = *(uint8_t *)cur_pos; + newId = evId; + if(evId == TRACE_HEARTBEAT) { + newId = 19; + } + cur_pos += sizeof(uint8_t); + time_delta = *(uint32_t*)cur_pos; + cur_pos += sizeof(uint32_t); + + if(ltt_log_cpu){ + write_to_buffer(write_pos[cpu_id],(void*)&newId,sizeof(uint16_t)); + write_to_buffer(write_pos[cpu_id],(void*)&time_delta, sizeof(uint32_t)); + }else{ + write_to_buffer(write_pos[0],(void*)&newId,sizeof(uint16_t)); + write_to_buffer(write_pos[0],(void*)&time_delta, sizeof(uint32_t)); + } + + if(evId == TRACE_BUFFER_END){ + if(ltt_log_cpu){ + int size, i; + if(has_event[i]) + write_to_buffer(write_pos[cpu_id],(void*)&end,sizeof(buffer_start)); + for(i=0;i=0){ + if(ltt_log_cpu){ + write_to_buffer(write_pos[cpu_id], cur_pos, event_size); + }else{ + write_to_buffer(write_pos[0], cur_pos, event_size); + } + + if(evId == TRACE_HEARTBEAT){ + if(ltt_log_cpu){ + write_to_buffer(write_pos[cpu_id],(void*)&beat , sizeof(heartbeat)); + }else{ + write_to_buffer(write_pos[0], (void*)&beat, sizeof(heartbeat)); + } + } + + cur_pos += event_size + sizeof(uint16_t); //skip data_size + }else if(evId == TRACE_FILE_SYSTEM){ + size_t nbBytes; + char c = '\0'; + tFileSys = (trace_file_system*)cur_pos; + subId = tFileSys->event_sub_id; + if(subId == TRACE_FILE_SYSTEM_OPEN || subId == TRACE_FILE_SYSTEM_EXEC){ + nbBytes = tFileSys->event_data2 +1; + }else nbBytes = 0; + + if(ltt_log_cpu){ + write_to_buffer(write_pos[cpu_id], cur_pos, event_size); + cur_pos += event_size + sizeof(char*); + if(nbBytes){ + write_to_buffer(write_pos[cpu_id], cur_pos, nbBytes); + }else{ + write_to_buffer(write_pos[cpu_id], (void*)&c, 1); + } + }else{ + write_to_buffer(write_pos[0], cur_pos, event_size); + cur_pos += event_size + sizeof(char*); + if(nbBytes){ + write_to_buffer(write_pos[0], cur_pos, nbBytes); + }else{ + write_to_buffer(write_pos[0], (void*)&c, 1); + } + } + cur_pos += nbBytes + sizeof(uint16_t); //skip data_size + }else if(event_size == -1){ + printf("Unknown event: evId=%d, i=%d, event_count=%d\n", newId, i, event_count); + exit(1); + } + } //end while(1) + + } + + + + + + //write to system.xml + fprintf(fp,"\n"); + fprintf(fp,"This is just a test\n"); + fprintf(fp,"\n"); + fflush(fp); + + fclose(fp); + + close(fdFac); + close(fdIntr); + close(fdProc); + close(fd); + for(i=0;i + The core facility contains the basic events + + + Facility used in the trace + + + + + + + + + Entry in a given system call + + Syscall entry number in entry.S + Address from which call was made + + + + + Exit from a given system call + + + + Entry in a trap + + Trap number + Address where trap occured + + + + + Exit from a trap + + + + Entry in an irq + + IRQ number + Are we executing kernel code + + + + + Exit from an IRQ + + + + Scheduling change + + Outgoing process + Incoming process + Outgoing process' state + + + + + The kernel timer routine has been called + + + + Hit key part of soft-irq management + + Soft-irq event Id + + + + + Data associated with event + + + + + Hit key part of process management + + Process event ID + + + + + Data associated with event + Data associated with event + + + + + Hit key part of file system + + File system event ID + + + + + Event data + Event data 2 + Name of file operated on + + + + + Hit key part of timer management + + Timer event ID + + + + + Short data + Data associated with event + Data associated with event + + + + + Hit key part of memory management + + Memory event ID + + + + + Data associated with event + + + + + Hit key part of socket communication + + Memory event ID + + + + + Data associated with event + Data associated with event + + + + + Hit key part of System V IPC + + Memory event ID + + + + + Data associated with event + Data associated with event + + + + + Hit key part of network communication + + Memory event ID + + + + + Data associated with event + + + + + Block start timestamp + + + + + Block end timestamp + + + + + System time values sent periodically to minimize cycle counter + drift with respect to real time clock and to detect cycle counter roolovers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ltt/attic-branches/yangxx/convert/sysInfo b/ltt/attic-branches/yangxx/convert/sysInfo new file mode 100755 index 00000000..1a81012e --- /dev/null +++ b/ltt/attic-branches/yangxx/convert/sysInfo @@ -0,0 +1,42 @@ +#!/bin/bash + +# DO NOT FORGET TO DISABLE ALL THE JAVA OPTIONS IN NETSCAPE +# OTHERWISE IT WILL DIE ... + +outputFile=sysInfo.out + +NODE_NAME=`uname -n` +echo "node_name="$NODE_NAME > $outputFile + +DOMAINNAME="`hostname --domain`" +echo "domainname="$DOMAINNAME >> $outputFile + +KERNEL_NAME="`uname -s`" +echo "kernel_name="$KERNEL_NAME >> $outputFile + +KERNEL_RELEASE="`uname -r`" +echo "kernel_release="$KERNEL_RELEASE >> $outputFile + +KERNEL_VERSION="`uname -v`" +echo "kernel_version="$KERNEL_VERSION >> $outputFile + +MACHINE="`uname -m`" +echo "machine="$MACHINE >> $outputFile + +PROCESSOR="`uname -p`" +echo "processor="$PROCESSOR >> $outputFile + +HARDWARE_PLATFORM="`uname -i`" +echo "hardware_platform="$HARDWARE_PLATFORM >> $outputFile + +OPERATING_SYSTEM="`uname -o`" +echo "operating_system="$OPERATING_SYSTEM >> $outputFile + + +#export $NODE_NAME +#export $NODE_NAME $DOMAINNAME $KERNEL_NAME $KERNEL_RELEASE $KERNEL_VERSION $MACHINE $PROCESSOR $HARDWARE_PLATFORM $OPERATING_SYSTEM + + + +#/sbin/lilo -C "$liloConf" + diff --git a/ltt/attic-branches/yangxx/smp_example/control/facilities b/ltt/attic-branches/yangxx/smp_example/control/facilities new file mode 100644 index 00000000..e69de29b diff --git a/ltt/attic-branches/yangxx/smp_example/control/interrupts b/ltt/attic-branches/yangxx/smp_example/control/interrupts new file mode 100644 index 00000000..e69de29b diff --git a/ltt/attic-branches/yangxx/smp_example/control/processes b/ltt/attic-branches/yangxx/smp_example/control/processes new file mode 100644 index 00000000..e69de29b diff --git a/ltt/attic-branches/yangxx/smp_example/cpu/0 b/ltt/attic-branches/yangxx/smp_example/cpu/0 new file mode 100644 index 00000000..fbb787b3 Binary files /dev/null and b/ltt/attic-branches/yangxx/smp_example/cpu/0 differ diff --git a/ltt/attic-branches/yangxx/smp_example/cpu/1 b/ltt/attic-branches/yangxx/smp_example/cpu/1 new file mode 100644 index 00000000..f8ab01ad Binary files /dev/null and b/ltt/attic-branches/yangxx/smp_example/cpu/1 differ diff --git a/ltt/attic-branches/yangxx/smp_example/eventdefs/core.xml b/ltt/attic-branches/yangxx/smp_example/eventdefs/core.xml new file mode 100644 index 00000000..f54441fd --- /dev/null +++ b/ltt/attic-branches/yangxx/smp_example/eventdefs/core.xml @@ -0,0 +1,262 @@ + + The core facility contains the basic events + + + Facility used in the trace + + + + + + + + + Entry in a given system call + + Syscall entry number in entry.S + Address from which call was made + + + + + Exit from a given system call + + + + Entry in a trap + + Trap number + Address where trap occured + + + + + Exit from a trap + + + + Entry in an irq + + IRQ number + Are we executing kernel code + + + + + Exit from an IRQ + + + + Scheduling change + + Outgoing process + Incoming process + Outgoing process' state + + + + + The kernel timer routine has been called + + + + Hit key part of soft-irq management + + Soft-irq event Id + + + + + Data associated with event + + + + + Hit key part of process management + + Process event ID + + + + + Data associated with event + Data associated with event + + + + + Hit key part of file system + + File system event ID + + + + + Event data + Event data 2 + Name of file operated on + + + + + Hit key part of timer management + + Timer event ID + + + + + Short data + Data associated with event + Data associated with event + + + + + Hit key part of memory management + + Memory event ID + + + + + Data associated with event + + + + + Hit key part of socket communication + + Memory event ID + + + + + Data associated with event + Data associated with event + + + + + Hit key part of System V IPC + + Memory event ID + + + + + Data associated with event + Data associated with event + + + + + Hit key part of network communication + + Memory event ID + + + + + Data associated with event + + + + + Block start timestamp + + + + + Block end timestamp + + + + + System time values sent periodically to minimize cycle counter + drift with respect to real time clock and to detect cycle counter roolovers + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fork a new process + + Data associated with event + Data associated with event + + + + + Exit from a process + + Data associated with event + Data associated with event + + + + + + diff --git a/ltt/attic-branches/yangxx/smp_example/info/system.xml b/ltt/attic-branches/yangxx/smp_example/info/system.xml new file mode 100644 index 00000000..975b2c2a --- /dev/null +++ b/ltt/attic-branches/yangxx/smp_example/info/system.xml @@ -0,0 +1,19 @@ + +This is just a test + diff --git a/ltt/branches/yangxx/convert/LTTTypes.h b/ltt/branches/yangxx/convert/LTTTypes.h deleted file mode 100644 index e493f84b..00000000 --- a/ltt/branches/yangxx/convert/LTTTypes.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * LTTTypes.h - * - * Copyright (C) 2000 Karim Yaghmour (karym@opersys.com). - * - * This is distributed under GPL. - * - * Header for LTT-secific types. - * - * History : - * K.Y. 07/09/2001, Added David Schleef's architecture independent ltt_set_bit/ltt_clear_bit/ltt_test_bit - * JAL, 05/01/2001, Modified PPC bit manipulation functions for x86 compatibility. - * (andy_lowe@mvista.com) - * K.Y., 31/05/2000, Initial typing. - */ - -#ifndef __TRACE_TOOLKIT_TYPES_HEADER__ -#define __TRACE_TOOLKIT_TYPES_HEADER__ - -#include -#include - -#if defined(sun) - -typedef unsigned char u_int8_t; -typedef unsigned short u_int16_t; -typedef unsigned int u_int32_t; -#ifdef _LP64 -typedef unsigned long u_int64_t; -#else /* _ILP32 */ -#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) -typedef unsigned long long u_int64_t; -#endif /* __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) */ -#endif /* _LP64 */ - -#endif /* defined(sun) */ - -extern __inline__ int ltt_set_bit(int nr, void * addr) -{ - unsigned char *p = addr; - unsigned char mask = 1 << (nr&7); - unsigned char old; - - p += nr>>3; - old = *p; - *p |= mask; - - return ((old & mask) != 0); -} - -extern __inline__ int ltt_clear_bit(int nr, void * addr) -{ - unsigned char *p = addr; - unsigned char mask = 1 << (nr&7); - unsigned char old; - - p += nr>>3; - old = *p; - *p &= ~mask; - - return ((old & mask) != 0); -} - -extern __inline__ int ltt_test_bit(int nr,void *addr) -{ - unsigned char *p = addr; - unsigned char mask = 1 << (nr&7); - - p += nr>>3; - - return ((*p & mask) != 0); -} - -/* Big-endian/little-endian conversion macros for cross-development. */ -#if TARGET_NATIVE -/* For native development, these conversion macros aren't needed. */ -#define BREV16(x) (x) -#define BREV32(x) (x) -#define BREV64(x) (x) -#define RFT8(db,x) (x) -#define RFT16(db,x) (x) -#define RFT32(db,x) (x) -#define RFT64(db,x) (x) - -/* Non-native development */ -#else - /* BREV16: byte-reverse a 16-bit integer */ -#define BREV16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8)) - /* BREV32: byte-reverse a 32-bit integer */ -#define BREV32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \ - | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) - /* BREV64: byte-reverse a 64-bit integer */ -#define BREV64(x) ((((x) & 0xff00000000000000) >> 56) \ - | (((x) & 0x00ff000000000000) >> 40) \ - | (((x) & 0x0000ff0000000000) >> 24) \ - | (((x) & 0x000000ff00000000) >> 8) \ - | (((x) & 0x00000000ff000000) << 8) \ - | (((x) & 0x0000000000ff0000) << 24) \ - | (((x) & 0x000000000000ff00) << 40) \ - | (((x) & 0x00000000000000ff) << 56)) - /* RFTn: Read From Trace - * Conditionally byte-reverse an 8-, 16-, 32-, or 64-bit integer - * based on the value of the ByteRev member of the trace database - * structure pointer passed as the first argument.. - */ -#define RFT8(db,x) (x) -#define RFT16(db,x) ((db)->ByteRev ? BREV16(x) : (x)) -#define RFT32(db,x) ((db)->ByteRev ? BREV32(x) : (x)) -#define RFT64(db,x) ((db)->ByteRev ? BREV64(x) : (x)) -#endif /* TRACE_TARGET_NATIVE */ - -#if !defined(sun) -/* Some type corrections, just in case */ -#ifndef uint8_t -#define uint8_t u_int8_t -#endif -#ifndef uint16_t -#define uint16_t u_int16_t -#endif -#ifndef uint32_t -#define uint32_t u_int32_t -#endif -#ifndef uint64_t -#define uint64_t u_int64_t -#endif -#endif /* !defined(sun) */ - -/* Structure packing */ -#if LTT_UNPACKED_STRUCTS -#define LTT_PACKED_STRUCT -#else -#define LTT_PACKED_STRUCT __attribute__ ((packed)) -#endif /* UNPACKED_STRUCTS */ - -/* Trace mask */ -typedef uint64_t trace_event_mask; - -/* Boolean stuff */ -//#define TRUE 1 -//#define FALSE 0 - -#endif /* __TRACE_TOOLKIT_TYPES_HEADER__ */ diff --git a/ltt/branches/yangxx/convert/LinuxEvents.h b/ltt/branches/yangxx/convert/LinuxEvents.h deleted file mode 100644 index 7496fa77..00000000 --- a/ltt/branches/yangxx/convert/LinuxEvents.h +++ /dev/null @@ -1,302 +0,0 @@ -/* - * LinuxEvents.h - * - * Copyright (C) 2000, 2001, 2002 Karim Yaghmour (karym@opersys.com). - * - * This header is distributed under GPL. - * - * Linux events being traced. - * - * History : - * K.Y., 31/05/1999, Initial typing. - * - */ - -#ifndef __TRACE_TOOLKIT_LINUX_HEADER__ -#define __TRACE_TOOLKIT_LINUX_HEADER__ - -#include - -/* Traced events */ -#define TRACE_START 0 /* This is to mark the trace's start */ -#define TRACE_SYSCALL_ENTRY 1 /* Entry in a given system call */ -#define TRACE_SYSCALL_EXIT 2 /* Exit from a given system call */ -#define TRACE_TRAP_ENTRY 3 /* Entry in a trap */ -#define TRACE_TRAP_EXIT 4 /* Exit from a trap */ -#define TRACE_IRQ_ENTRY 5 /* Entry in an irq */ -#define TRACE_IRQ_EXIT 6 /* Exit from an irq */ -#define TRACE_SCHEDCHANGE 7 /* Scheduling change */ -#define TRACE_KERNEL_TIMER 8 /* The kernel timer routine has been called */ -#define TRACE_SOFT_IRQ 9 /* Hit key part of soft-irq management */ -#define TRACE_PROCESS 10 /* Hit key part of process management */ -#define TRACE_FILE_SYSTEM 11 /* Hit key part of file system */ -#define TRACE_TIMER 12 /* Hit key part of timer management */ -#define TRACE_MEMORY 13 /* Hit key part of memory management */ -#define TRACE_SOCKET 14 /* Hit key part of socket communication */ -#define TRACE_IPC 15 /* Hit key part of inter-process communication */ -#define TRACE_NETWORK 16 /* Hit key part of network communication */ - -#define TRACE_BUFFER_START 17 /* Mark the begining of a trace buffer */ -#define TRACE_BUFFER_END 18 /* Mark the ending of a trace buffer */ -#define TRACE_NEW_EVENT 19 /* New event type */ -#define TRACE_CUSTOM 20 /* Custom event */ - -#define TRACE_CHANGE_MASK 21 /* Change in event mask */ -#define TRACE_HEARTBEAT 22 /* Heartbeat event */ - -/* Number of traced events */ -#define TRACE_MAX TRACE_HEARTBEAT - -/* Architecture types */ -#define TRACE_ARCH_TYPE_I386 1 /* i386 system */ -#define TRACE_ARCH_TYPE_PPC 2 /* PPC system */ -#define TRACE_ARCH_TYPE_SH 3 /* SH system */ -#define TRACE_ARCH_TYPE_S390 4 /* S/390 system */ -#define TRACE_ARCH_TYPE_MIPS 5 /* MIPS system */ -#define TRACE_ARCH_TYPE_ARM 6 /* ARM system */ - -/* Standard definitions for variants */ -#define TRACE_ARCH_VARIANT_NONE 0 /* Main architecture implementation */ - -/* PowerPC variants */ -#define TRACE_ARCH_VARIANT_PPC_4xx 1 /* 4xx systems (IBM embedded series) */ -#define TRACE_ARCH_VARIANT_PPC_6xx 2 /* 6xx/7xx/74xx/8260/POWER3 systems (desktop flavor) */ -#define TRACE_ARCH_VARIANT_PPC_8xx 3 /* 8xx system (Motoral embedded series) */ -#define TRACE_ARCH_VARIANT_PPC_ISERIES 4 /* 8xx system (iSeries) */ - -/* System types */ -#define TRACE_SYS_TYPE_VANILLA_LINUX 1 /* Vanilla linux kernel */ -#define TRACE_SYS_TYPE_RTAI_LINUX 2 /* RTAI patched linux kernel */ - -/* The information logged when the tracing is started */ -#define TRACER_MAGIC_NUMBER 0x00D6B7ED /* That day marks an important historical event ... */ -#define TRACER_SUP_VERSION_MAJOR 2 /* Major version number */ -#define TRACER_SUP_VERSION_MINOR 2 /* Minor version number */ -typedef struct _trace_start -{ - uint32_t MagicNumber; /* Magic number to identify a trace */ - uint32_t ArchType; /* Type of architecture */ - uint32_t ArchVariant; /* Variant of the given type of architecture */ - uint32_t SystemType; /* Operating system type */ - uint8_t MajorVersion; /* Major version of trace */ - uint8_t MinorVersion; /* Minor version of trace */ - - uint32_t BufferSize; /* Size of buffers */ - trace_event_mask EventMask; /* The event mask */ - trace_event_mask DetailsMask; /* Are the event details logged */ - uint8_t LogCPUID; /* Is the CPUID logged */ - uint8_t UseTSC; /* Are we using TSCs or time deltas */ - -} LTT_PACKED_STRUCT trace_start; -#define START_EVENT(X) ((trace_start*)X) - -/* TRACE_SYSCALL_ENTRY */ -typedef struct _trace_syscall_entry -{ - uint8_t syscall_id; /* Syscall entry number in entry.S */ - uint32_t address; /* Address from which call was made */ -} LTT_PACKED_STRUCT trace_syscall_entry; -#define SYSCALL_EVENT(X) ((trace_syscall_entry*)X) - -/* TRACE_TRAP_ENTRY */ -typedef struct _trace_trap_entry -{ - uint16_t trap_id; /* Trap number */ - uint32_t address; /* Address where trap occured */ -} LTT_PACKED_STRUCT trace_trap_entry; -typedef struct _trace_trap_entry_s390 -{ - uint64_t trap_id; /* Trap number */ - uint32_t address; /* Address where trap occured */ -} LTT_PACKED_STRUCT trace_trap_entry_s390; -#define TRAP_EVENT(X) ((trace_trap_entry*)X) -#define TRAP_EVENT_S390(X) ((trace_trap_entry_s390*)X) - -/* TRACE_IRQ_ENTRY */ -typedef struct _trace_irq_entry -{ - uint8_t irq_id; /* IRQ number */ - uint8_t kernel; /* Are we executing kernel code */ -} LTT_PACKED_STRUCT trace_irq_entry; -#define IRQ_EVENT(X) ((trace_irq_entry*)X) - -/* TRACE_SCHEDCHANGE */ -typedef struct _trace_schedchange -{ - uint32_t out; /* Outgoing process */ - uint32_t in; /* Incoming process */ - uint32_t out_state; /* Outgoing process' state */ -} LTT_PACKED_STRUCT trace_schedchange; -#define SCHED_EVENT(X) ((trace_schedchange*)X) - -/* TRACE_SOFT_IRQ */ -#define TRACE_SOFT_IRQ_BOTTOM_HALF 1 /* Conventional bottom-half */ -#define TRACE_SOFT_IRQ_SOFT_IRQ 2 /* Real soft-irq */ -#define TRACE_SOFT_IRQ_TASKLET_ACTION 3 /* Tasklet action */ -#define TRACE_SOFT_IRQ_TASKLET_HI_ACTION 4 /* Tasklet hi-action */ -typedef struct _trace_soft_irq -{ - uint8_t event_sub_id; /* Soft-irq event Id */ - uint32_t event_data; /* Data associated with event */ -} LTT_PACKED_STRUCT trace_soft_irq; -#define SOFT_IRQ_EVENT(X) ((trace_soft_irq*)X) - -/* TRACE_PROCESS */ -#define TRACE_PROCESS_KTHREAD 1 /* Creation of a kernel thread */ -#define TRACE_PROCESS_FORK 2 /* A fork or clone occured */ -#define TRACE_PROCESS_EXIT 3 /* An exit occured */ -#define TRACE_PROCESS_WAIT 4 /* A wait occured */ -#define TRACE_PROCESS_SIGNAL 5 /* A signal has been sent */ -#define TRACE_PROCESS_WAKEUP 6 /* Wake up a process */ -typedef struct _trace_process -{ - uint8_t event_sub_id; /* Process event ID */ - uint32_t event_data1; /* Data associated with event */ - uint32_t event_data2; -} LTT_PACKED_STRUCT trace_process; -#define PROC_EVENT(X) ((trace_process*)X) - -/* TRACE_FILE_SYSTEM */ -#define TRACE_FILE_SYSTEM_BUF_WAIT_START 1 /* Starting to wait for a data buffer */ -#define TRACE_FILE_SYSTEM_BUF_WAIT_END 2 /* End to wait for a data buffer */ -#define TRACE_FILE_SYSTEM_EXEC 3 /* An exec occured */ -#define TRACE_FILE_SYSTEM_OPEN 4 /* An open occured */ -#define TRACE_FILE_SYSTEM_CLOSE 5 /* A close occured */ -#define TRACE_FILE_SYSTEM_READ 6 /* A read occured */ -#define TRACE_FILE_SYSTEM_WRITE 7 /* A write occured */ -#define TRACE_FILE_SYSTEM_SEEK 8 /* A seek occured */ -#define TRACE_FILE_SYSTEM_IOCTL 9 /* An ioctl occured */ -#define TRACE_FILE_SYSTEM_SELECT 10 /* A select occured */ -#define TRACE_FILE_SYSTEM_POLL 11 /* A poll occured */ -typedef struct _trace_file_system -{ - uint8_t event_sub_id; /* File system event ID */ - uint32_t event_data1; /* Event data */ - uint32_t event_data2; /* Event data 2 */ - char* file_name; /* Name of file operated on */ -} LTT_PACKED_STRUCT trace_file_system; -#define FS_EVENT(X) ((trace_file_system*)X) -#define FS_EVENT_FILENAME(X) ((char*) ((X) + sizeof(trace_file_system))) - -/* TRACE_TIMER */ -#define TRACE_TIMER_EXPIRED 1 /* Timer expired */ -#define TRACE_TIMER_SETITIMER 2 /* Setting itimer occurred */ -#define TRACE_TIMER_SETTIMEOUT 3 /* Setting sched timeout occurred */ -typedef struct _trace_timer -{ - uint8_t event_sub_id; /* Timer event ID */ - uint8_t event_sdata; /* Short data */ - uint32_t event_data1; /* Data associated with event */ - uint32_t event_data2; -} LTT_PACKED_STRUCT trace_timer; -#define TIMER_EVENT(X) ((trace_timer*)X) - -/* TRACE_MEMORY */ -#define TRACE_MEMORY_PAGE_ALLOC 1 /* Allocating pages */ -#define TRACE_MEMORY_PAGE_FREE 2 /* Freing pages */ -#define TRACE_MEMORY_SWAP_IN 3 /* Swaping pages in */ -#define TRACE_MEMORY_SWAP_OUT 4 /* Swaping pages out */ -#define TRACE_MEMORY_PAGE_WAIT_START 5 /* Start to wait for page */ -#define TRACE_MEMORY_PAGE_WAIT_END 6 /* End to wait for page */ -typedef struct _trace_memory -{ - uint8_t event_sub_id; /* Memory event ID */ - unsigned long event_data; /* Data associated with event */ -} LTT_PACKED_STRUCT trace_memory; -#define MEM_EVENT(X) ((trace_memory*)X) - -/* TRACE_SOCKET */ -#define TRACE_SOCKET_CALL 1 /* A socket call occured */ -#define TRACE_SOCKET_CREATE 2 /* A socket has been created */ -#define TRACE_SOCKET_SEND 3 /* Data was sent to a socket */ -#define TRACE_SOCKET_RECEIVE 4 /* Data was read from a socket */ -typedef struct _trace_socket -{ - uint8_t event_sub_id; /* Socket event ID */ - uint32_t event_data1; /* Data associated with event */ - uint32_t event_data2; /* Data associated with event */ -} LTT_PACKED_STRUCT trace_socket; -#define SOCKET_EVENT(X) ((trace_socket*)X) - -/* TRACE_IPC */ -#define TRACE_IPC_CALL 1 /* A System V IPC call occured */ -#define TRACE_IPC_MSG_CREATE 2 /* A message queue has been created */ -#define TRACE_IPC_SEM_CREATE 3 /* A semaphore was created */ -#define TRACE_IPC_SHM_CREATE 4 /* A shared memory segment has been created */ -typedef struct _trace_ipc -{ - uint8_t event_sub_id; /* IPC event ID */ - uint32_t event_data1; /* Data associated with event */ - uint32_t event_data2; /* Data associated with event */ -} LTT_PACKED_STRUCT trace_ipc; -#define IPC_EVENT(X) ((trace_ipc*)X) - -/* TRACE_NETWORK */ -#define TRACE_NETWORK_PACKET_IN 1 /* A packet came in */ -#define TRACE_NETWORK_PACKET_OUT 2 /* A packet was sent */ -typedef struct _trace_network -{ - uint8_t event_sub_id; /* Network event ID */ - uint32_t event_data; /* Event data */ -} LTT_PACKED_STRUCT trace_network; -#define NET_EVENT(X) ((trace_network*)X) - -/* Start of trace buffer information */ -typedef struct _trace_buffer_start -{ - struct timeval Time; /* Time stamp of this buffer */ - uint32_t TSC; /* TSC of this buffer, if applicable */ - uint32_t ID; /* Unique buffer ID */ -} LTT_PACKED_STRUCT trace_buffer_start; - -/* End of trace buffer information */ -typedef struct _trace_buffer_end -{ - struct timeval Time; /* Time stamp of this buffer */ - uint32_t TSC; /* TSC of this buffer, if applicable */ -} LTT_PACKED_STRUCT trace_buffer_end; - -/* Maximal size a custom event can have */ -#define CUSTOM_EVENT_MAX_SIZE 8192 - -/* String length limits for custom events creation */ -#define CUSTOM_EVENT_TYPE_STR_LEN 20 -#define CUSTOM_EVENT_DESC_STR_LEN 100 -#define CUSTOM_EVENT_FORM_STR_LEN 256 - -/* Type of custom event formats */ -#define CUSTOM_EVENT_FORMAT_TYPE_NONE 0 -#define CUSTOM_EVENT_FORMAT_TYPE_STR 1 -#define CUSTOM_EVENT_FORMAT_TYPE_HEX 2 -#define CUSTOM_EVENT_FORMAT_TYPE_XML 3 -#define CUSTOM_EVENT_FORMAT_TYPE_IBM 4 - -typedef struct _trace_new_event -{ - /* Basics */ - uint32_t id; /* Custom event ID */ - char type[CUSTOM_EVENT_TYPE_STR_LEN]; /* Event type description */ - char desc[CUSTOM_EVENT_DESC_STR_LEN]; /* Detailed event description */ - - /* Custom formatting */ - uint32_t format_type; /* Type of formatting */ - char form[CUSTOM_EVENT_FORM_STR_LEN]; /* Data specific to format */ -} LTT_PACKED_STRUCT trace_new_event; -#define NEW_EVENT(X) ((trace_new_event*) X) - -typedef struct _trace_custom -{ - uint32_t id; /* Event ID */ - uint32_t data_size; /* Size of data recorded by event */ - void* data; /* Data recorded by event */ -} LTT_PACKED_STRUCT trace_custom; -#define CUSTOM_EVENT(X) ((trace_custom*) X) - -/* TRACE_CHANGE_MASK */ -typedef struct _trace_change_mask -{ - trace_event_mask mask; /* Event mask */ -} LTT_PACKED_STRUCT trace_change_mask; -#define CHMASK_EVENT(X) ((trace_change_mask*) X) - -#endif /* __TRACE_TOOLKIT_LINUX_HEADER__ */ diff --git a/ltt/branches/yangxx/convert/Makefile b/ltt/branches/yangxx/convert/Makefile deleted file mode 100644 index e70473a9..00000000 --- a/ltt/branches/yangxx/convert/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -CC=gcc -CFLAGS=-g -o -CMPFLAGS=-g -c -INCLUDEPATH=-Iinclude - -#GLIB_CFLAGS = -I/usr/include/glib-1.2 -I/usr/lib/glib/include -GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -#GLIB_CFLAGS = -I/usr/include/glib-2.0 - -GLIB_CONFIG = /usr/bin/glib-config -GLIB_LIBS = -L/usr/lib -lglib - -OBJ= convert.o - - -test: $(OBJ) - $(CC) $(CFLAGS) test $(OBJ) $(GLIB_LIBS) - -convert.o: convert.c - $(CC) $(INCLUDEPATH) $(GLIB_CFLAGS) $(CMPFLAGS) convert.c - - - -clean: - rm -rf *.o *~ *# - - diff --git a/ltt/branches/yangxx/convert/convert.c b/ltt/branches/yangxx/convert/convert.c deleted file mode 100644 index 2b79d5d5..00000000 --- a/ltt/branches/yangxx/convert/convert.c +++ /dev/null @@ -1,604 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include "LTTTypes.h" -#include "LinuxEvents.h" - -#define write_to_buffer(DEST, SRC, SIZE) \ -do\ -{\ - memcpy(DEST, SRC, SIZE);\ - DEST += SIZE;\ -} while(0); - -int readFile(int fd, void * buf, size_t size, char * mesg) -{ - ssize_t nbBytes; - nbBytes = read(fd, buf, size); - if(nbBytes != size){ - printf("%s\n",mesg); - exit(1); - } - return 0; -} - -void getDataEndianType(char * size, char * endian) -{ - int i = 1; - char c = (char) i; - int sizeInt=sizeof(int), sizeLong=sizeof(long), sizePointer=sizeof(void *); - - if(c == 1) strcpy(endian,"LITTLE_ENDIAN"); - else strcpy(endian, "BIG_ENDIAN"); - - if(sizeInt == 2 && sizeLong == 4 && sizePointer == 4) - strcpy(size,"LP32"); - else if(sizeInt == 4 && sizeLong == 4 && sizePointer == 4) - strcpy(size,"ILP32"); - else if(sizeInt == 4 && sizeLong == 8 && sizePointer == 8) - strcpy(size,"LP64"); - else if(sizeInt == 8 && sizeLong == 8 && sizePointer == 8) - strcpy(size,"ILP64"); - else strcpy(size,"UNKNOWN"); -} - -#define BUFFER_SIZE 80 - -typedef struct _buffer_start{ - uint32_t seconds; - uint32_t nanoseconds; - uint64_t cycle_count; - uint32_t block_id; -} __attribute__ ((packed)) buffer_start; - -typedef struct _heartbeat{ - uint32_t seconds; - uint32_t nanoseconds; - uint64_t cycle_count; -} __attribute__ ((packed)) heartbeat; - - -int main(int argc, char ** argv){ - - int fd, *fdCpu; - FILE * fp; - int fdFac, fdIntr, fdProc; - char arch_size[BUFFER_SIZE]; - char endian[BUFFER_SIZE]; - char node_name[BUFFER_SIZE]; - char domainname[BUFFER_SIZE]; - char kernel_name[BUFFER_SIZE]; - char kernel_release[BUFFER_SIZE]; - char kernel_version[BUFFER_SIZE]; - char machine[BUFFER_SIZE]; - char processor[BUFFER_SIZE]; - char hardware_platform[BUFFER_SIZE]; - char operating_system[BUFFER_SIZE]; - int cpu; - int ltt_block_size; - int ltt_major_version; - int ltt_minor_version; - int ltt_log_cpu; - char buf[BUFFER_SIZE]; - int i,j; - - uint8_t cpu_id; - - char foo[4*BUFFER_SIZE]; - char foo_eventdefs[4*BUFFER_SIZE]; - char foo_control[4*BUFFER_SIZE]; - char foo_cpu[4*BUFFER_SIZE]; - char foo_info[4*BUFFER_SIZE]; - - char foo_control_facilities[4*BUFFER_SIZE]; - char foo_control_processes[4*BUFFER_SIZE]; - char foo_control_interrupts[4*BUFFER_SIZE]; - char foo_info_system[4*BUFFER_SIZE]; - - struct stat lTDFStat; - off_t file_size; - int block_number, block_size; - char * buffer, **buf_out, cpuStr[4*BUFFER_SIZE]; - char * buf_fac, * buf_intr, * buf_proc; - void ** write_pos, *write_pos_fac, * write_pos_intr, *write_pos_proc; - trace_start *tStart; - trace_buffer_start *tBufStart; - trace_buffer_end *tBufEnd; - trace_file_system * tFileSys; - uint16_t newId, startId; - uint8_t evId; - uint32_t time_delta, startTimeDelta; - void * cur_pos, *end_pos; - buffer_start start; - buffer_start end; - heartbeat beat; - int beat_count = 0; - gboolean * has_event; - uint32_t size_lost; - int reserve_size = sizeof(buffer_start) + sizeof(uint16_t) + 2*sizeof(uint32_t);//lost_size and buffer_end event - - if(argc != 3 && argc != 4){ - printf("need a trace file and cpu number or root directory for the new tracefile\n"); - exit(1); - } - - if(argc == 3){ - strcpy(foo, "foo"); - strcpy(foo_eventdefs, "foo/eventdefs"); - strcpy(foo_control, "foo/control"); - strcpy(foo_cpu, "foo/cpu"); - strcpy(foo_info, "foo/info"); - }else{ - strcpy(foo, argv[3]); - strcpy(foo_eventdefs, argv[3]); - strcat(foo_eventdefs,"/eventdefs"); - strcpy(foo_control, argv[3]); - strcat(foo_control,"/control"); - strcpy(foo_cpu, argv[3]); - strcat(foo_cpu,"/cpu"); - strcpy(foo_info, argv[3]); - strcat(foo_info,"/info"); - } - strcpy(foo_control_facilities, foo_control); - strcat(foo_control_facilities,"/facilities"); - strcpy(foo_control_processes, foo_control); - strcat(foo_control_processes, "/processes"); - strcpy(foo_control_interrupts, foo_control); - strcat(foo_control_interrupts, "/interrupts"); - strcpy(foo_info_system, foo_info); - strcat(foo_info_system, "/system.xml"); - - cpu = atoi(argv[2]); - printf("cpu number = %d\n", cpu); - - - getDataEndianType(arch_size, endian); - printf("Arch_size: %s, Endian: %s\n", arch_size, endian); - - fp = fopen("sysInfo.out","r"); - if(!fp){ - g_error("Unable to open file sysInfo.out\n"); - } - - for(i=0;i<9;i++){ - if(!fgets(buf,BUFFER_SIZE-1,fp)) - g_error("The format of sysInfo.out is not right\n"); - if(strncmp(buf,"node_name=",10)==0){ - strcpy(node_name,&buf[10]); - node_name[strlen(node_name)-1] = '\0'; - }else if(strncmp(buf,"domainname=",11)==0){ - strcpy(domainname,&buf[11]); - domainname[strlen(domainname)-1] = '\0'; - }else if(strncmp(buf,"kernel_name=",12)==0){ - strcpy(kernel_name,&buf[12]); - kernel_name[strlen(kernel_name)-1] = '\0'; - }else if(strncmp(buf,"kernel_release=",15)==0){ - strcpy(kernel_release,&buf[15]); - kernel_release[strlen(kernel_release)-1] = '\0'; - }else if(strncmp(buf,"kernel_version=",15)==0){ - strcpy(kernel_version,&buf[15]); - kernel_version[strlen(kernel_version)-1] = '\0'; - }else if(strncmp(buf,"machine=",8)==0){ - strcpy(machine,&buf[8]); - machine[strlen(machine)-1] = '\0'; - }else if(strncmp(buf,"processor=",10)==0){ - strcpy(processor,&buf[10]); - processor[strlen(processor)-1] = '\0'; - }else if(strncmp(buf,"hardware_platform=",18)==0){ - strcpy(hardware_platform,&buf[18]); - hardware_platform[strlen(hardware_platform)-1] = '\0'; - }else if(strncmp(buf,"operating_system=",17)==0){ - strcpy(operating_system,&buf[17]); - operating_system[strlen(operating_system)-1] = '\0'; - } - } - fclose(fp); - - if(mkdir(foo, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) - g_error("can not make %s directory", foo); - if(mkdir(foo_info, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) - g_error("can not make %s directory", foo_info); - if(mkdir(foo_cpu, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) - g_error("can not make %s directory", foo_cpu); - if(mkdir(foo_control, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) - g_error("can not make %s directory", foo_control); - if(mkdir(foo_eventdefs, S_IFDIR | S_IRWXU | S_IRGRP | S_IROTH)) - g_error("can not make %s directory", foo_eventdefs); - - fp = fopen(foo_info_system,"w"); - if(!fp){ - g_error("Unable to open file system.xml\n"); - } - - fd = open(argv[1], O_RDONLY, 0); - if(fd < 0){ - g_error("Unable to open input data file %s\n", argv[1]); - } - - fdFac = open(foo_control_facilities,O_CREAT | O_RDWR | O_TRUNC,S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); - if(fdFac < 0){ - g_error("Unable to open file facilities\n"); - } - fdIntr = open(foo_control_interrupts,O_CREAT | O_RDWR | O_TRUNC,S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); - if(fdIntr<0){ - g_error("Unable to open file interrupts\n"); - } - fdProc = open(foo_control_processes,O_CREAT | O_RDWR | O_TRUNC,S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH); - if(fdIntr<0){ - g_error("Unable to open file process\n"); - } - - - - if(fstat(fd, &lTDFStat) < 0){ - g_error("Unable to get the status of the input data file\n"); - } - file_size = lTDFStat.st_size; - - buffer = g_new(char, 4000); - readFile(fd,(void*)buffer, 3500, "Unable to read block header"); - - cur_pos= buffer; - evId = *(uint8_t *)cur_pos; - cur_pos += sizeof(uint8_t); - newId = evId; - time_delta = *(uint32_t*)cur_pos; - cur_pos += sizeof(uint32_t); - tBufStart = (trace_buffer_start*)cur_pos; - cur_pos += sizeof(trace_buffer_start); - cur_pos += sizeof(uint16_t); //Skip event size - - evId = *(uint8_t *)cur_pos; - cur_pos += sizeof(uint8_t); - cur_pos += sizeof(uint32_t); - tStart = (trace_start*)cur_pos; - - startId = newId; - startTimeDelta = time_delta; - start.seconds = tBufStart->Time.tv_sec; - start.nanoseconds = tBufStart->Time.tv_usec; - start.cycle_count = tBufStart->TSC; - start.block_id = tBufStart->ID; - end.block_id = start.block_id; - - ltt_major_version = tStart->MajorVersion; - ltt_minor_version = tStart->MinorVersion; - ltt_block_size = tStart->BufferSize; - ltt_log_cpu = tStart->LogCPUID; - - block_size = ltt_block_size; - block_number = file_size/block_size; - - g_free(buffer); - buffer = g_new(char, block_size); - buf_fac = g_new(char, block_size); - write_pos_fac = buf_fac; - buf_intr = g_new(char, block_size); - write_pos_intr = buf_intr; - buf_proc = g_new(char, block_size); - write_pos_proc = buf_proc; - - buf_out = g_new(char*,cpu); - write_pos = g_new(void*, cpu); - fdCpu = g_new(int, cpu); - has_event = g_new(gboolean, cpu); - for(i=0;iTime.tv_sec; - start.nanoseconds = tBufStart->Time.tv_usec; - start.cycle_count = tBufStart->TSC; - start.block_id = tBufStart->ID; - end.block_id = start.block_id; - - end_pos = buffer + block_size; //end of the buffer - size_lost = *(uint32_t*)(end_pos - sizeof(uint32_t)); - - end_pos = buffer + block_size - size_lost ; //buffer_end event - if(ltt_log_cpu){ - tBufEnd = (trace_buffer_end*)(end_pos + 2 * sizeof(uint8_t)+sizeof(uint32_t)); - }else{ - tBufEnd = (trace_buffer_end*)(end_pos+sizeof(uint8_t)+sizeof(uint32_t)); - } - end.seconds = tBufEnd->Time.tv_sec; - end.nanoseconds = tBufEnd->Time.tv_usec; - end.cycle_count = tBufEnd->TSC; - - //skip buffer start and trace start events - if(i==0) //the first block - cur_pos = buffer + sizeof(trace_buffer_start) + sizeof(trace_start) + 2*(sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint32_t)); - else //other blocks - cur_pos = buffer + sizeof(trace_buffer_start) + sizeof(uint8_t)+sizeof(uint16_t)+sizeof(uint32_t); - - //for cpu 0, always make records - write_to_buffer(write_pos[0],(void*)&startId, sizeof(uint16_t)); - write_to_buffer(write_pos[0],(void*)&startTimeDelta, sizeof(uint32_t)); - write_to_buffer(write_pos[0],(void*)&start, sizeof(buffer_start)); - - //write start block event into processes and interrupts files - write_to_buffer(write_pos_intr,(void*)&startId, sizeof(uint16_t)); - write_to_buffer(write_pos_intr,(void*)&startTimeDelta, sizeof(uint32_t)); - write_to_buffer(write_pos_intr,(void*)&start, sizeof(buffer_start)); - write_to_buffer(write_pos_proc,(void*)&startId, sizeof(uint16_t)); - write_to_buffer(write_pos_proc,(void*)&startTimeDelta, sizeof(uint32_t)); - write_to_buffer(write_pos_proc,(void*)&start, sizeof(buffer_start)); - - while(1){ - int event_size; - uint64_t timeDelta; - uint8_t subId; - - if(ltt_log_cpu){ - cpu_id = *(uint8_t*)cur_pos; - cur_pos += sizeof(uint8_t); - if(cpu_id != 0 && has_event[cpu_id] == FALSE){ - has_event[cpu_id] = TRUE; - write_to_buffer(write_pos[cpu_id],(void*)&startId,sizeof(uint16_t)); - write_to_buffer(write_pos[cpu_id],(void*)&startTimeDelta, sizeof(uint32_t)); - write_to_buffer(write_pos[cpu_id],(void*)&start, sizeof(buffer_start)); - } - } - evId = *(uint8_t *)cur_pos; - newId = evId; - if(evId == TRACE_HEARTBEAT) { - newId = 19; - } - cur_pos += sizeof(uint8_t); - time_delta = *(uint32_t*)cur_pos; - cur_pos += sizeof(uint32_t); - - if(ltt_log_cpu){ - write_to_buffer(write_pos[cpu_id],(void*)&newId,sizeof(uint16_t)); - write_to_buffer(write_pos[cpu_id],(void*)&time_delta, sizeof(uint32_t)); - }else{ - write_to_buffer(write_pos[0],(void*)&newId,sizeof(uint16_t)); - write_to_buffer(write_pos[0],(void*)&time_delta, sizeof(uint32_t)); - } - - if(evId == TRACE_BUFFER_END){ - if(ltt_log_cpu){ - int size, i; - if(has_event[i]) - write_to_buffer(write_pos[cpu_id],(void*)&end,sizeof(buffer_start)); - for(i=0;i=0){ - if(ltt_log_cpu){ - write_to_buffer(write_pos[cpu_id], cur_pos, event_size); - }else{ - write_to_buffer(write_pos[0], cur_pos, event_size); - } - - if(evId == TRACE_HEARTBEAT){ - if(ltt_log_cpu){ - write_to_buffer(write_pos[cpu_id],(void*)&beat , sizeof(heartbeat)); - }else{ - write_to_buffer(write_pos[0], (void*)&beat, sizeof(heartbeat)); - } - } - - cur_pos += event_size + sizeof(uint16_t); //skip data_size - }else if(evId == TRACE_FILE_SYSTEM){ - size_t nbBytes; - char c = '\0'; - tFileSys = (trace_file_system*)cur_pos; - subId = tFileSys->event_sub_id; - if(subId == TRACE_FILE_SYSTEM_OPEN || subId == TRACE_FILE_SYSTEM_EXEC){ - nbBytes = tFileSys->event_data2 +1; - }else nbBytes = 0; - - if(ltt_log_cpu){ - write_to_buffer(write_pos[cpu_id], cur_pos, event_size); - cur_pos += event_size + sizeof(char*); - if(nbBytes){ - write_to_buffer(write_pos[cpu_id], cur_pos, nbBytes); - }else{ - write_to_buffer(write_pos[cpu_id], (void*)&c, 1); - } - }else{ - write_to_buffer(write_pos[0], cur_pos, event_size); - cur_pos += event_size + sizeof(char*); - if(nbBytes){ - write_to_buffer(write_pos[0], cur_pos, nbBytes); - }else{ - write_to_buffer(write_pos[0], (void*)&c, 1); - } - } - cur_pos += nbBytes + sizeof(uint16_t); //skip data_size - }else if(event_size == -1){ - printf("Unknown event: evId=%d, i=%d, event_count=%d\n", newId, i, event_count); - exit(1); - } - } //end while(1) - - } - - - - - - //write to system.xml - fprintf(fp,"\n"); - fprintf(fp,"This is just a test\n"); - fprintf(fp,"\n"); - fflush(fp); - - fclose(fp); - - close(fdFac); - close(fdIntr); - close(fdProc); - close(fd); - for(i=0;i - The core facility contains the basic events - - - Facility used in the trace - - - - - - - - - Entry in a given system call - - Syscall entry number in entry.S - Address from which call was made - - - - - Exit from a given system call - - - - Entry in a trap - - Trap number - Address where trap occured - - - - - Exit from a trap - - - - Entry in an irq - - IRQ number - Are we executing kernel code - - - - - Exit from an IRQ - - - - Scheduling change - - Outgoing process - Incoming process - Outgoing process' state - - - - - The kernel timer routine has been called - - - - Hit key part of soft-irq management - - Soft-irq event Id - - - - - Data associated with event - - - - - Hit key part of process management - - Process event ID - - - - - Data associated with event - Data associated with event - - - - - Hit key part of file system - - File system event ID - - - - - Event data - Event data 2 - Name of file operated on - - - - - Hit key part of timer management - - Timer event ID - - - - - Short data - Data associated with event - Data associated with event - - - - - Hit key part of memory management - - Memory event ID - - - - - Data associated with event - - - - - Hit key part of socket communication - - Memory event ID - - - - - Data associated with event - Data associated with event - - - - - Hit key part of System V IPC - - Memory event ID - - - - - Data associated with event - Data associated with event - - - - - Hit key part of network communication - - Memory event ID - - - - - Data associated with event - - - - - Block start timestamp - - - - - Block end timestamp - - - - - System time values sent periodically to minimize cycle counter - drift with respect to real time clock and to detect cycle counter roolovers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ltt/branches/yangxx/convert/sysInfo b/ltt/branches/yangxx/convert/sysInfo deleted file mode 100755 index 1a81012e..00000000 --- a/ltt/branches/yangxx/convert/sysInfo +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# DO NOT FORGET TO DISABLE ALL THE JAVA OPTIONS IN NETSCAPE -# OTHERWISE IT WILL DIE ... - -outputFile=sysInfo.out - -NODE_NAME=`uname -n` -echo "node_name="$NODE_NAME > $outputFile - -DOMAINNAME="`hostname --domain`" -echo "domainname="$DOMAINNAME >> $outputFile - -KERNEL_NAME="`uname -s`" -echo "kernel_name="$KERNEL_NAME >> $outputFile - -KERNEL_RELEASE="`uname -r`" -echo "kernel_release="$KERNEL_RELEASE >> $outputFile - -KERNEL_VERSION="`uname -v`" -echo "kernel_version="$KERNEL_VERSION >> $outputFile - -MACHINE="`uname -m`" -echo "machine="$MACHINE >> $outputFile - -PROCESSOR="`uname -p`" -echo "processor="$PROCESSOR >> $outputFile - -HARDWARE_PLATFORM="`uname -i`" -echo "hardware_platform="$HARDWARE_PLATFORM >> $outputFile - -OPERATING_SYSTEM="`uname -o`" -echo "operating_system="$OPERATING_SYSTEM >> $outputFile - - -#export $NODE_NAME -#export $NODE_NAME $DOMAINNAME $KERNEL_NAME $KERNEL_RELEASE $KERNEL_VERSION $MACHINE $PROCESSOR $HARDWARE_PLATFORM $OPERATING_SYSTEM - - - -#/sbin/lilo -C "$liloConf" - diff --git a/ltt/branches/yangxx/smp_example/control/facilities b/ltt/branches/yangxx/smp_example/control/facilities deleted file mode 100644 index e69de29b..00000000 diff --git a/ltt/branches/yangxx/smp_example/control/interrupts b/ltt/branches/yangxx/smp_example/control/interrupts deleted file mode 100644 index e69de29b..00000000 diff --git a/ltt/branches/yangxx/smp_example/control/processes b/ltt/branches/yangxx/smp_example/control/processes deleted file mode 100644 index e69de29b..00000000 diff --git a/ltt/branches/yangxx/smp_example/cpu/0 b/ltt/branches/yangxx/smp_example/cpu/0 deleted file mode 100644 index fbb787b3..00000000 Binary files a/ltt/branches/yangxx/smp_example/cpu/0 and /dev/null differ diff --git a/ltt/branches/yangxx/smp_example/cpu/1 b/ltt/branches/yangxx/smp_example/cpu/1 deleted file mode 100644 index f8ab01ad..00000000 Binary files a/ltt/branches/yangxx/smp_example/cpu/1 and /dev/null differ diff --git a/ltt/branches/yangxx/smp_example/eventdefs/core.xml b/ltt/branches/yangxx/smp_example/eventdefs/core.xml deleted file mode 100644 index f54441fd..00000000 --- a/ltt/branches/yangxx/smp_example/eventdefs/core.xml +++ /dev/null @@ -1,262 +0,0 @@ - - The core facility contains the basic events - - - Facility used in the trace - - - - - - - - - Entry in a given system call - - Syscall entry number in entry.S - Address from which call was made - - - - - Exit from a given system call - - - - Entry in a trap - - Trap number - Address where trap occured - - - - - Exit from a trap - - - - Entry in an irq - - IRQ number - Are we executing kernel code - - - - - Exit from an IRQ - - - - Scheduling change - - Outgoing process - Incoming process - Outgoing process' state - - - - - The kernel timer routine has been called - - - - Hit key part of soft-irq management - - Soft-irq event Id - - - - - Data associated with event - - - - - Hit key part of process management - - Process event ID - - - - - Data associated with event - Data associated with event - - - - - Hit key part of file system - - File system event ID - - - - - Event data - Event data 2 - Name of file operated on - - - - - Hit key part of timer management - - Timer event ID - - - - - Short data - Data associated with event - Data associated with event - - - - - Hit key part of memory management - - Memory event ID - - - - - Data associated with event - - - - - Hit key part of socket communication - - Memory event ID - - - - - Data associated with event - Data associated with event - - - - - Hit key part of System V IPC - - Memory event ID - - - - - Data associated with event - Data associated with event - - - - - Hit key part of network communication - - Memory event ID - - - - - Data associated with event - - - - - Block start timestamp - - - - - Block end timestamp - - - - - System time values sent periodically to minimize cycle counter - drift with respect to real time clock and to detect cycle counter roolovers - - - - - - - - - - - - - - - - - - - - - - - - - - - - Fork a new process - - Data associated with event - Data associated with event - - - - - Exit from a process - - Data associated with event - Data associated with event - - - - - - diff --git a/ltt/branches/yangxx/smp_example/info/system.xml b/ltt/branches/yangxx/smp_example/info/system.xml deleted file mode 100644 index 975b2c2a..00000000 --- a/ltt/branches/yangxx/smp_example/info/system.xml +++ /dev/null @@ -1,19 +0,0 @@ - -This is just a test -