From 31cbc5d38faf2afcf879ec0636e580192f0b817c Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 3 Jun 2005 19:31:49 +0000 Subject: [PATCH] genevent type enhancements and xml split git-svn-id: http://ltt.polymtl.ca/svn@935 04897980-b3bd-0310-b5e0-8ef037075253 --- genevent/core.xml | 226 ++------------------------------ genevent/fs.xml | 89 +++++++++++++ genevent/genevent.c | 270 ++++++++++++++++++++++++++------------- genevent/genevent.h | 6 +- genevent/heartbeat.xml | 26 ++++ genevent/ipc.xml | 36 ++++++ genevent/kernel.xml | 86 +++++++++++++ genevent/memory.xml | 49 +++++++ genevent/network.xml | 20 +++ genevent/parser.c | 114 ++++++++++++++--- genevent/parser.h | 10 +- genevent/process.xml | 116 +++++++++++++++++ genevent/s390-kernel.xml | 12 ++ genevent/socket.xml | 47 +++++++ genevent/timer.xml | 51 ++++++++ 15 files changed, 838 insertions(+), 320 deletions(-) create mode 100644 genevent/fs.xml create mode 100644 genevent/heartbeat.xml create mode 100644 genevent/ipc.xml create mode 100644 genevent/kernel.xml create mode 100644 genevent/memory.xml create mode 100644 genevent/network.xml create mode 100644 genevent/process.xml create mode 100644 genevent/s390-kernel.xml create mode 100644 genevent/socket.xml create mode 100644 genevent/timer.xml diff --git a/genevent/core.xml b/genevent/core.xml index b2e6e004..0dfe9d0a 100644 --- a/genevent/core.xml +++ b/genevent/core.xml @@ -1,234 +1,39 @@ - The core facility contains the basic events + The core facility contains the basic tracing related events - Facility used in the trace + Facility is loaded - + - - Entry in a given system call + + Facility is unloaded - 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 - - + + - - - - - - - - + @@ -239,8 +44,5 @@ -*/ - - diff --git a/genevent/fs.xml b/genevent/fs.xml new file mode 100644 index 00000000..2e475023 --- /dev/null +++ b/genevent/fs.xml @@ -0,0 +1,89 @@ + + The fs facility contains events related to file system operation + + + Staring to wait for a buffer + + Address of the buffer head. + + + + + Ending to wait for a buffer + + Address of the buffer head. + + + + + Executing a file + + File name + + + + + Opening a file + + File name + File descriptor + + + + + Closing a file descriptor + + File descriptor + + + + + Reading from a file descriptor + + File descriptor + Number of bytes to read + + + + + Write to a file descriptor + + File descriptor + Number of bytes to write + + + + + Seek a file descriptor + + File descriptor + Number of bytes to write + Number of bytes to write + + + + + Do a IOCTL on a file descriptor + + File descriptor + Command + Argument + + + + + Do a select on a file descriptor + + File descriptor + Time out + + + + + Do a poll on a file descriptor + + File descriptor + + + + diff --git a/genevent/genevent.c b/genevent/genevent.c index 073ba9c3..e6c5bb89 100644 --- a/genevent/genevent.c +++ b/genevent/genevent.c @@ -36,6 +36,7 @@ This program is distributed in the hope that it will be useful, #include #include +#include #include #include #include @@ -44,6 +45,7 @@ This program is distributed in the hope that it will be useful, #include "parser.h" #include "genevent.h" + /* Named types may be referenced from anywhere */ facility * fac; @@ -80,18 +82,19 @@ int main(int argc, char** argv) token = getName(&in); if(strcmp("facility",token) == 0) { - fac = memAlloc(sizeof(facility)); - fac->name = NULL; - fac->description = NULL; - sequence_init(&(fac->events)); - table_init(&(fac->named_types)); - sequence_init(&(fac->unnamed_types)); - - parseFacility(&in, fac); - - //check if any namedType is not defined - checkNamedTypesImplemented(&fac->named_types); - }else in.error(&in,"facility token was expected"); + fac = memAlloc(sizeof(facility)); + fac->name = NULL; + fac->description = NULL; + sequence_init(&(fac->events)); + table_init(&(fac->named_types)); + sequence_init(&(fac->unnamed_types)); + + parseFacility(&in, fac); + + //check if any namedType is not defined + checkNamedTypesImplemented(&fac->named_types); + } + else in.error(&in,"facility token was expected"); generateFile(argv[i]); @@ -159,8 +162,12 @@ void generateFile(char *name){ generateChecksum(fac->name, &checksum, &(fac->events)); /* generate .h file, event enumeration then structures and functions */ - generateEnumEvent(hFp, fac->name, &nbEvent); - generateStructFunc(hFp, fac->name); + fprintf(hFp, "#ifndef _LTT_FACILITY_%s_H_\n",fac->capname); + fprintf(hFp, "#define _LTT_FACILITY_%s_H_\n\n",fac->capname); + generateEnumEvent(hFp, fac->name, &nbEvent, checksum); + generateTypeDefs(hFp); + generateStructFunc(hFp, fac->name,checksum); + fprintf(hFp, "#endif //_LTT_FACILITY_%s_H_\n",fac->capname); /* generate .c file, calls to register the facility at init time */ generateCfile(cFp,fac->name,nbEvent,checksum); @@ -179,22 +186,19 @@ void generateFile(char *name){ *Output Params * nbEvent : number of events in the facility ****************************************************************************/ -void generateEnumEvent(FILE *fp, char *facName, int * nbEvent) { +void generateEnumEvent(FILE *fp, char *facName, int * nbEvent, unsigned long checksum) { int pos = 0; - //will be removed later - fprintf(fp,"typedef unsigned int trace_facility_t;\n\n"); - fprintf(fp,"extern int trace_new(trace_facility_t fID, u8 eID, int length, char * buf);\n\n"); - + fprintf(fp,"#include \n\n"); fprintf(fp,"/**** facility handle ****/\n\n"); - fprintf(fp,"extern trace_facility_t facility_%s;\n\n\n",facName); + fprintf(fp,"extern trace_facility_t ltt_facility_%s_%X;\n\n\n",facName, checksum); fprintf(fp,"/**** event type ****/\n\n"); fprintf(fp,"enum %s_event {\n",facName); for(pos = 0; pos < fac->events.position;pos++) { - fprintf(fp," %s", ((event *)(fac->events.array[pos]))->name); + fprintf(fp,"\t%s", ((event *)(fac->events.array[pos]))->name); if(pos != fac->events.position-1) fprintf(fp,",\n"); } fprintf(fp,"\n};\n\n\n"); @@ -205,6 +209,93 @@ void generateEnumEvent(FILE *fp, char *facName, int * nbEvent) { } +/***************************************************************************** + *Function name + * printStruct : Generic struct printing function + *Input Params + * fp : file to be written to + * len : number of fields + * array : array of field info + * name : basic struct name + * facName : name of facility + * whichTypeFirst : struct or array/sequence first + * hasStrSeq : string or sequence present? + * structCount : struct postfix + ****************************************************************************/ +static void +printStruct(FILE * fp, int len, void ** array, char * name, char * facName, + int * whichTypeFirst, int * hasStrSeq, int * structCount) +{ + int flag = 0; + int pos; + field * fld; + type_descriptor * td; + + for (pos = 0; pos < len; pos++) { + fld = (field *)array[pos]; + td = fld->type; + if( td->type != STRING && td->type != SEQUENCE && + td->type != ARRAY) { + if (*whichTypeFirst == 0) { + *whichTypeFirst = 1; //struct first + } + if (flag == 0) { + flag = 1; + + fprintf(fp,"struct %s_%s", + name, facName); + if (structCount) { + fprintf(fp, "_%d {\n", + ++*structCount); + } else { + fprintf(fp, " {\n"); + } + } + fprintf(fp, "\t%s %s; /* %s */\n", + getTypeStr(td),fld->name,fld->description ); + } else { + if (*whichTypeFirst == 0) { + //string or sequence or array first + *whichTypeFirst = 2; + } + (*hasStrSeq)++; + if(flag) { + fprintf(fp,"} __attribute__ ((packed));\n\n"); + } + flag = 0; + } + } + + if(flag) { + fprintf(fp,"} __attribute__ ((packed));\n\n"); + } +} + + +/***************************************************************************** + *Function name + * generateHfile : Create the typedefs + *Input Params + * fp : file to be written to + ****************************************************************************/ +void +generateTypeDefs(FILE * fp) +{ + int pos, tmp = 1; + + fprintf(fp, "/**** Basic Type Definitions ****/\n\n"); + + for (pos = 0; pos < fac->named_types.values.position; pos++) { + type_descriptor * type = + (type_descriptor*)fac->named_types.values.array[pos]; + printStruct(fp, type->fields.position, type->fields.array, + "", type->type_name, &tmp, &tmp, NULL); + fprintf(fp, "typedef struct _%s %s;\n\n", + type->type_name, type->type_name); + } +} + + /***************************************************************************** *Function name * generateEnumDefinition: generate enum definition if it exists @@ -217,7 +308,7 @@ void generateEnumDefinition(FILE * fp, type_descriptor * type){ fprintf(fp,"enum {\n"); for(pos = 0; pos < type->labels.position; pos++){ - fprintf(fp," %s", type->labels.array[pos]); + fprintf(fp,"\t%s", type->labels.array[pos]); if (pos != type->labels.position - 1) fprintf(fp,",\n"); } fprintf(fp,"\n};\n\n\n"); @@ -230,7 +321,7 @@ void generateEnumDefinition(FILE * fp, type_descriptor * type){ * fp : file to be written to * facName : name of facility ****************************************************************************/ -void generateStructFunc(FILE * fp, char * facName){ +void generateStructFunc(FILE * fp, char * facName, unsigned long checksum){ event * ev; field * fld; type_descriptor * td; @@ -243,7 +334,7 @@ void generateStructFunc(FILE * fp, char * facName){ fprintf(fp,"/**** structure and trace function for event: %s ****/\n\n",ev->name); if(ev->type == 0){ // event without type fprintf(fp,"static inline void trace_%s_%s(void){\n",facName,ev->name); - fprintf(fp," trace_new(facility_%s, %s, 0, NULL);\n",facName,ev->name); + fprintf(fp,"\tltt_log_event(ltt_facility_%s_%X, %s, 0, NULL);\n",facName,checksum,ev->name); fprintf(fp,"};\n\n\n"); continue; } @@ -257,30 +348,11 @@ void generateStructFunc(FILE * fp, char * facName){ //default: no string, array or sequence in the event hasStrSeq = 0; whichTypeFirst = 0; - - //structure for kernel - flag = 0; structCount = 0; - for(pos1 = 0; pos1 < ev->type->fields.position; pos1++){ - fld = (field *)ev->type->fields.array[pos1]; - td = fld->type; - if( td->type != STRING && td->type != SEQUENCE && td->type != ARRAY){ - if(whichTypeFirst == 0) whichTypeFirst = 1; //struct first - if(flag == 0){ - flag = 1; - fprintf(fp,"struct %s_%s_%d{\n",ev->name,facName,++structCount); - } - fprintf(fp, " %s %s; /* %s */\n",getTypeStr(td),fld->name,fld->description ); - }else{ - if(whichTypeFirst == 0) whichTypeFirst = 2; //string or sequence or array first - hasStrSeq++; - if(flag) - fprintf(fp,"} __attribute__ ((packed));\n\n"); - flag = 0; - } - } - if(flag) - fprintf(fp,"} __attribute__ ((packed));\n\n"); + + //structure for kernel + printStruct(fp, ev->type->fields.position, ev->type->fields.array, + ev->name, facName, &whichTypeFirst, &hasStrSeq, &structCount); //trace function : function name and parameters seqCount = 0; @@ -301,7 +373,7 @@ void generateStructFunc(FILE * fp, char * facName){ fprintf(fp,"){\n"); //length of buffer : length of all structures - fprintf(fp," int bufLength = "); + fprintf(fp,"\tint bufLength = "); for(pos1=0;pos1name, facName,pos1+1); if(pos1 != structCount-1) fprintf(fp," + "); @@ -325,24 +397,24 @@ void generateStructFunc(FILE * fp, char * facName){ fprintf(fp,";\n"); //allocate buffer - fprintf(fp," char buff[bufLength];\n"); + fprintf(fp,"\tchar buff[bufLength];\n"); //declare a char pointer if needed - if(structCount + hasStrSeq > 1) fprintf(fp," char * ptr = buff;\n"); + if(structCount + hasStrSeq > 1) fprintf(fp,"\tchar * ptr = buff;\n"); //allocate memory for new struct and initialize it if(whichTypeFirst == 1){ //struct first for(pos1=0;pos1name, facName,ev->name, facName); - else fprintf(fp," struct %s_%s_%d __%d;\n",ev->name, facName,pos1+1,pos1+1); + if(pos1==0) fprintf(fp,"\tstruct %s_%s_1 * __1 = (struct %s_%s_1 *)buff;\n",ev->name, facName,ev->name, facName); + else fprintf(fp,"\tstruct %s_%s_%d __%d;\n",ev->name, facName,pos1+1,pos1+1); } }else if(whichTypeFirst == 2){ for(pos1=0;pos1name, facName,pos1+1,pos1+1); + fprintf(fp,"\tstruct %s_%s_%d __%d;\n",ev->name, facName,pos1+1,pos1+1); } fprintf(fp,"\n"); - if(structCount) fprintf(fp," //initialize structs\n"); + if(structCount) fprintf(fp,"\t//initialize structs\n"); flag = 0; structCount = 0; for(pos1 = 0; pos1 < ev->type->fields.position; pos1++){ @@ -354,16 +426,16 @@ void generateStructFunc(FILE * fp, char * facName){ structCount++; if(structCount > 1) fprintf(fp,"\n"); } - if(structCount == 1 && whichTypeFirst == 1) fprintf(fp, " __1->%s = %s;\n",fld->name,fld->name ); - else fprintf(fp, " __%d.%s = %s;\n",structCount ,fld->name,fld->name); + if(structCount == 1 && whichTypeFirst == 1) fprintf(fp, "\t__1->%s = %s;\n",fld->name,fld->name ); + else fprintf(fp, "\t__%d.%s = %s;\n",structCount ,fld->name,fld->name); }else flag = 0; } if(structCount) fprintf(fp,"\n"); //set ptr to the end of first struct if needed; if(whichTypeFirst == 1 && structCount + hasStrSeq > 1){ - fprintf(fp,"\n //set ptr to the end of the first struct\n"); - fprintf(fp," ptr += sizeof(struct %s_%s_1);\n\n",ev->name, facName); + fprintf(fp,"\n\t//set ptr to the end of the first struct\n"); + fprintf(fp,"\tptr += sizeof(struct %s_%s_1);\n\n",ev->name, facName); } //copy struct, sequence and string to buffer @@ -378,39 +450,39 @@ void generateStructFunc(FILE * fp, char * facName){ if(flag == 0) structCount++; flag++; if((structCount > 1 || whichTypeFirst == 2) && flag == 1){ - fprintf(fp," //copy struct to buffer\n"); - fprintf(fp," memcpy(ptr, &__%d, sizeof(struct %s_%s_%d));\n",structCount, ev->name, facName,structCount); - fprintf(fp," ptr += sizeof(struct %s_%s_%d);\n\n",ev->name, facName,structCount); + fprintf(fp,"\t//copy struct to buffer\n"); + fprintf(fp,"\tmemcpy(ptr, &__%d, sizeof(struct %s_%s_%d));\n",structCount, ev->name, facName,structCount); + fprintf(fp,"\tptr += sizeof(struct %s_%s_%d);\n\n",ev->name, facName,structCount); } }else if(td->type == SEQUENCE){ flag = 0; - fprintf(fp," //copy sequence length and sequence to buffer\n"); - fprintf(fp," *ptr = seqLength_%d;\n",++seqCount); - fprintf(fp," ptr += sizeof(%s);\n",uintOutputTypes[td->size]); - fprintf(fp," memcpy(ptr, %s, sizeof(%s) * seqLength_%d);\n",fld->name, getTypeStr(td), seqCount); - fprintf(fp," ptr += sizeof(%s) * seqLength_%d;\n\n",getTypeStr(td), seqCount ); + fprintf(fp,"\t//copy sequence length and sequence to buffer\n"); + fprintf(fp,"\t*ptr = seqLength_%d;\n",++seqCount); + fprintf(fp,"\tptr += sizeof(%s);\n",uintOutputTypes[td->size]); + fprintf(fp,"\tmemcpy(ptr, %s, sizeof(%s) * seqLength_%d);\n",fld->name, getTypeStr(td), seqCount); + fprintf(fp,"\tptr += sizeof(%s) * seqLength_%d;\n\n",getTypeStr(td), seqCount ); }else if(td->type==STRING){ flag = 0; - fprintf(fp," //copy string to buffer\n"); - fprintf(fp," if(strLength_%d > 0){\n",++strCount); - fprintf(fp," memcpy(ptr, %s, strLength_%d + 1);\n", fld->name, strCount); - fprintf(fp," ptr += strLength_%d + 1;\n",strCount); - fprintf(fp," }else{\n"); - fprintf(fp," *ptr = '\\0';\n"); - fprintf(fp," ptr += 1;\n"); - fprintf(fp," }\n\n"); + fprintf(fp,"\t//copy string to buffer\n"); + fprintf(fp,"\tif(strLength_%d > 0){\n",++strCount); + fprintf(fp,"\t\tmemcpy(ptr, %s, strLength_%d + 1);\n", fld->name, strCount); + fprintf(fp,"\t\tptr += strLength_%d + 1;\n",strCount); + fprintf(fp,"\t}else{\n"); + fprintf(fp,"\t\t*ptr = '\\0';\n"); + fprintf(fp,"\t\tptr += 1;\n"); + fprintf(fp,"\t}\n\n"); }else if(td->type==ARRAY){ flag = 0; - fprintf(fp," //copy array to buffer\n"); - fprintf(fp," memcpy(ptr, %s, sizeof(%s) * %d);\n", fld->name, getTypeStr(td), td->size); - fprintf(fp," ptr += sizeof(%s) * %d;\n\n",getTypeStr(td), td->size); + fprintf(fp,"\t//copy array to buffer\n"); + fprintf(fp,"\tmemcpy(ptr, %s, sizeof(%s) * %d);\n", fld->name, getTypeStr(td), td->size); + fprintf(fp,"\tptr += sizeof(%s) * %d;\n\n",getTypeStr(td), td->size); } } if(structCount + seqCount > 1) fprintf(fp,"\n"); //call trace function - fprintf(fp,"\n //call trace function\n"); - fprintf(fp," trace_new(facility_%s, %s, bufLength, buff);\n",facName,ev->name); + fprintf(fp,"\n\t//call trace function\n"); + fprintf(fp,"\tltt_log_event(ltt_facility_%s_%X, %s, bufLength, buff);\n",facName,checksum,ev->name); fprintf(fp,"};\n\n\n"); } @@ -432,6 +504,18 @@ char * getTypeStr(type_descriptor * td){ return intOutputTypes[td->size]; case UINT: return uintOutputTypes[td->size]; + case POINTER: + return "void *"; + case LONG: + return "long"; + case ULONG: + return "unsigned long"; + case SIZE_T: + return "size_t"; + case SSIZE_T: + return "ssize_t"; + case OFF_T: + return "off_t"; case FLOAT: return floatOutputTypes[td->size]; case STRING: @@ -443,18 +527,30 @@ char * getTypeStr(type_descriptor * td){ t = td->nested_type; switch(t->type){ case INT: - return intOutputTypes[t->size]; + return intOutputTypes[t->size]; case UINT: - return uintOutputTypes[t->size]; + return uintOutputTypes[t->size]; + case POINTER: + return "void *"; + case LONG: + return "long"; + case ULONG: + return "unsigned long"; + case SIZE_T: + return "size_t"; + case SSIZE_T: + return "ssize_t"; + case OFF_T: + return "off_t"; case FLOAT: - return floatOutputTypes[t->size]; + return floatOutputTypes[t->size]; case STRING: - return "char"; + return "char"; case ENUM: - return uintOutputTypes[t->size]; + return uintOutputTypes[t->size]; default : - error_callback(NULL,"Nested struct is not supportted"); - break; + error_callback(NULL,"Nested struct is not supportted"); + break; } break; case STRUCT: //for now we do not support nested struct @@ -485,7 +581,7 @@ void generateCfile(FILE * fp, char * facName, int nbEvent, unsigned long checksu fprintf(fp,"trace_facility_t facility_%s;\n\n",facName); fprintf(fp,"static void __init facility_%s_init(){\n",facName); - fprintf(fp," facility_%s = trace_register_facility_by_checksum(\"%s\", checksum,%d);\n",facName,facName,nbEvent); + fprintf(fp,"\tfacility_%s = trace_register_facility_by_checksum(\"%s\", checksum,%d);\n",facName,facName,nbEvent); fprintf(fp,"}\n\n"); fprintf(fp,"static void __exit facility_%s_exit(){\n",facName); diff --git a/genevent/genevent.h b/genevent/genevent.h index 2e2050ca..bea164a7 100644 --- a/genevent/genevent.h +++ b/genevent/genevent.h @@ -1,7 +1,9 @@ void generateFile(char * file); -void generateEnumEvent(FILE * fp,char * facName, int * nbEvent); -void generateStructFunc(FILE * fp, char * facName); +void generateHfile(FILE *); +void generateTypeDefs(FILE *); +void generateEnumEvent(FILE * fp,char * facName, int * nbEvent, unsigned long checksum); +void generateStructFunc(FILE * fp, char * facName, unsigned long checksum); void generateCfile(FILE * fp, char * facName, int nbEvent, unsigned long checksum); void generateEnumDefinition(FILE * fp, type_descriptor * fHead); char * getTypeStr(type_descriptor * td); diff --git a/genevent/heartbeat.xml b/genevent/heartbeat.xml new file mode 100644 index 00000000..9bbd0d99 --- /dev/null +++ b/genevent/heartbeat.xml @@ -0,0 +1,26 @@ + + The heartbeat facility has event related to heartbeat timer + + + System time values sent periodically to detect cycle counter + rollovers. Useful when only the 32 LSB of the TSC are saved in events + header : we save the full 64 bits in this event. + + + + + + + + + + + + + + + + + + + diff --git a/genevent/ipc.xml b/genevent/ipc.xml new file mode 100644 index 00000000..e66d7270 --- /dev/null +++ b/genevent/ipc.xml @@ -0,0 +1,36 @@ + + The ipc facility contains events related to Inter Process Communication + + + IPC call + + Number of IPC call + First argument + + + + + Get an IPC message queue identifier + + Message queue identifier + Message flags + + + + + Get an IPC semaphore identifier + + Semaphore identifier + Semaphore flags + + + + + Get an IPC shared memory identifier + + Shared memory identifier + Shared memory flags + + + + diff --git a/genevent/kernel.xml b/genevent/kernel.xml new file mode 100644 index 00000000..b2448663 --- /dev/null +++ b/genevent/kernel.xml @@ -0,0 +1,86 @@ + + The kernel facility has events related to kernel execution status. + + + System call entry + + Syscall entry number in entry.S + Address from which call was made + + + + + System call exit + + + + Entry in a trap + + Trap number + Address where trap occured + + + + + Exit from a trap + + + + Soft IRQ entry + + Soft IRQ number + + + + + Soft IRQ exit + + Soft IRQ number + + + + + Tasklet entry + + Tasklet priority + Tasklet function address + + + + + Tasklet exit + + Tasklet priority + Tasklet function address + + + + + Entry in an irq + + IRQ number + Are we executing kernel code + + + + + Exit from an IRQ + + + + + + + + + + + + + + + diff --git a/genevent/memory.xml b/genevent/memory.xml new file mode 100644 index 00000000..2c27d3c5 --- /dev/null +++ b/genevent/memory.xml @@ -0,0 +1,49 @@ + + The memory facility has memory management events. + + + Page allocation + + Order of the page to allocate + Assigned page address, or 0 if + failed. + + + + + Page free + + Order of the page to free + Address of the page to free. + + + + + Page swapped into memory + + Address of the page to swap in. + + + + + Page swapped to disk + + Address of the page to swap out. + + + + + Staring to wait for a page + + Address of the page we wait for. + + + + + Ending wait for a page + + Address of the page we wait for. + + + + diff --git a/genevent/network.xml b/genevent/network.xml new file mode 100644 index 00000000..f80f8cb4 --- /dev/null +++ b/genevent/network.xml @@ -0,0 +1,20 @@ + + The network facility contains events related to low level network operations + + + A packet is arriving + + Socket buffer pointer : identify the socket buffer + Protocol of the packet + + + + + We send a packet + + Socket buffer pointer : identify the socket buffer + Protocol of the packet + + + + diff --git a/genevent/parser.c b/genevent/parser.c index b6561ca5..465f9cb4 100644 --- a/genevent/parser.c +++ b/genevent/parser.c @@ -42,6 +42,35 @@ This program is distributed in the hope that it will be useful, #include "parser.h" +/* helper function */ +void strupper(char *string) +{ + char *ptr = string; + + while(*ptr != '\0') { + *ptr = toupper(*ptr); + ptr++; + } +} + + +int getSizeindex(int value) +{ + switch(value) { + case 1: + return 0; + case 2: + return 1; + case 4: + return 2; + case 8: + return 3; + default: + printf("Error : unknown value size %d\n", value); + exit(-1); + } +} + /***************************************************************************** *Function name * getSize : translate from string to integer @@ -261,6 +290,8 @@ void parseFacility(parse_file *in, facility * fac) event *ev; fac->name = allocAndCopy(getNameAttribute(in)); + fac->capname = allocAndCopy(fac->name); + strupper(fac->capname); getRAnglebracket(in); fac->description = getDescription(in); @@ -527,6 +558,48 @@ type_descriptor *parseType(parse_file *in, type_descriptor *inType, getForwardslash(in); getRAnglebracket(in); } + else if(strcmp(token,"pointer") == 0) { + t->type = POINTER; + t->size = 0; + t->fmt = allocAndCopy(getFormatAttribute(in)); + getForwardslash(in); + getRAnglebracket(in); + } + else if(strcmp(token,"long") == 0) { + t->type = LONG; + t->size = 0; + t->fmt = allocAndCopy(getFormatAttribute(in)); + getForwardslash(in); + getRAnglebracket(in); + } + else if(strcmp(token,"ulong") == 0) { + t->type = ULONG; + t->size = 0; + t->fmt = allocAndCopy(getFormatAttribute(in)); + getForwardslash(in); + getRAnglebracket(in); + } + else if(strcmp(token,"size_t") == 0) { + t->type = SIZE_T; + t->size = 0; + t->fmt = allocAndCopy(getFormatAttribute(in)); + getForwardslash(in); + getRAnglebracket(in); + } + else if(strcmp(token,"ssize_t") == 0) { + t->type = SSIZE_T; + t->size = 0; + t->fmt = allocAndCopy(getFormatAttribute(in)); + getForwardslash(in); + getRAnglebracket(in); + } + else if(strcmp(token,"off_t") == 0) { + t->type = OFF_T; + t->size = 0; + t->fmt = allocAndCopy(getFormatAttribute(in)); + getForwardslash(in); + getRAnglebracket(in); + } else if(strcmp(token,"float") == 0) { t->type = FLOAT; t->size = getSizeAttribute(in); @@ -820,7 +893,7 @@ char *getToken(parse_file * in) in->buffer[0] = car; pos = 1; while((car = getc(fp)) != EOF && pos < BUFFER_SIZE) { - if(!isalnum(car)) { + if(!(isalnum(car) || car == '_')) { ungetc(car,fp); break; } @@ -864,21 +937,6 @@ void skipEOL(parse_file * in) if(car == EOF)ungetc(car, in->fp); } -int isalpha(char c) -{ - int i,j; - if(c == '_')return 1; - i = c - 'a'; - j = c - 'A'; - if((i>=0 && i<26) || (j>=0 && j<26)) return 1; - return 0; -} - -int isalnum(char c) -{ - return (isalpha(c) || isdigit(c)); -} - /***************************************************************************** *Function name * checkNamedTypesImplemented : check if all named types have definition @@ -954,6 +1012,30 @@ unsigned long getTypeChecksum(unsigned long aCrc, type_descriptor * type) case UINT: str = uintOutputTypes[type->size]; break; + case POINTER: + str = allocAndCopy("void *"); + flag = 1; + break; + case LONG: + str = allocAndCopy("long"); + flag = 1; + break; + case ULONG: + str = allocAndCopy("unsigned long"); + flag = 1; + break; + case SIZE_T: + str = allocAndCopy("size_t"); + flag = 1; + break; + case SSIZE_T: + str = allocAndCopy("ssize_t"); + flag = 1; + break; + case OFF_T: + str = allocAndCopy("off_t"); + flag = 1; + break; case FLOAT: str = floatOutputTypes[type->size]; break; diff --git a/genevent/parser.h b/genevent/parser.h index 66120776..368d656e 100644 --- a/genevent/parser.h +++ b/genevent/parser.h @@ -68,8 +68,6 @@ char seekNextChar(parse_file *in); void skipComment(parse_file * in); void skipEOL(parse_file * in); -int isalpha(char car); -int isalnum(char car); /* Some constants */ @@ -81,6 +79,12 @@ static const int BUFFER_SIZE = 1024; typedef enum _data_type { INT, UINT, + POINTER, + LONG, + ULONG, + SIZE_T, + SSIZE_T, + OFF_T, FLOAT, STRING, ENUM, @@ -91,7 +95,6 @@ typedef enum _data_type { NONE } data_type; - /* Event type descriptors */ typedef struct _type_descriptor { @@ -124,6 +127,7 @@ typedef struct _event { typedef struct _facility { char * name; + char * capname; char * description; sequence events; sequence unnamed_types; diff --git a/genevent/process.xml b/genevent/process.xml new file mode 100644 index 00000000..85dbf433 --- /dev/null +++ b/genevent/process.xml @@ -0,0 +1,116 @@ + + The process facility has events related to process handling in + the kernel. + + + Process fork + + PID of the parent process + PID of the child process + + + + + Just created a new kernel thread + + PID of the kernel thread + Function called + + + + + + Process exit + + PID of the process + + + + + Process wait + + PID of the waiting process + PID of the process waited for + + + + + Process kernel data structure free (end of life of a zombie) + + PID of the freed process + + + + + Process kill system call + + PID of the process + PID of the process to kill + Signal number + + + + + Process signal reception + + PID of the receiving process + Signal number + + + + + Process wakeup + + PID of the receiving process + State of the awakened process. -1 unrunnable, 0 runnable, >0 stopped. + + + + + Scheduling change + + Outgoing process + Incoming process + Outgoing process' state. -1 unrunnable, 0 runnable, >0 stopped. + + + + + + + + + + diff --git a/genevent/s390-kernel.xml b/genevent/s390-kernel.xml new file mode 100644 index 00000000..8334c9d6 --- /dev/null +++ b/genevent/s390-kernel.xml @@ -0,0 +1,12 @@ + + The kernel facility has events related to kernel execution status. + + + Entry in a trap + + Trap number + Address where trap occured + + + + diff --git a/genevent/socket.xml b/genevent/socket.xml new file mode 100644 index 00000000..4669e7ab --- /dev/null +++ b/genevent/socket.xml @@ -0,0 +1,47 @@ + + The socket facility contains events related to sockets + + + Generic socket call : FIXME : should be more detailed. + + Number of socket call + + + + + Create a socket + + Socket family + Socket type + Socket protocol + Socket file descriptor + + + + + Sending a socket message + + Socket structure address + Socket family + Socket type + Socket protocol + Size of the message + + + + + Receiving a socket message + + Socket structure address + Socket family + Socket type + Socket protocol + Size of the message + + + + + + + + diff --git a/genevent/timer.xml b/genevent/timer.xml new file mode 100644 index 00000000..8f84e3fd --- /dev/null +++ b/genevent/timer.xml @@ -0,0 +1,51 @@ + + The timer facility has events related to timer events in the kernel. + + + A timer or itimer has expired. + + PID of the process to wake up. + + + + + The timer softirq is currently runned. + + + + An interval timer is set. + + kind of interval timer. + + + timer interval. + + + current value. + + + + + + + + + + + + + + + + + + -- 2.34.1