summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--lket.5.in13
-rw-r--r--parse.cxx12
-rw-r--r--runtime/ChangeLog6
-rw-r--r--runtime/lket/b2a/lket_b2a.c411
-rw-r--r--runtime/lket/b2a/lket_b2a.h96
-rw-r--r--staptree.cxx2
-rw-r--r--staptree.h1
-rw-r--r--tapset/LKET/Changelog6
-rwxr-xr-xtapset/LKET/hookid_defs.stp51
-rwxr-xr-xtapset/LKET/ioscheduler.stp25
-rwxr-xr-xtapset/LKET/lket_trace.stp31
-rwxr-xr-xtapset/LKET/netdev.stp18
-rwxr-xr-xtapset/LKET/pagefault.stp6
-rwxr-xr-xtapset/LKET/process.stp24
-rwxr-xr-xtapset/LKET/register_event.stp164
-rwxr-xr-xtapset/LKET/scsi.stp27
-rwxr-xr-xtapset/LKET/syscalls.stp31
-rwxr-xr-xtapset/LKET/tskdispatch.stp20
-rw-r--r--translate.cxx5
20 files changed, 553 insertions, 403 deletions
diff --git a/ChangeLog b/ChangeLog
index d6a4863b..d4a97565 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-06-09 Li Guanglei <guanglei@cn.ibm.com>
+
+ * parse.cxx, staptree.cxx, staptree.h, translate.cxx:
+ delete lket_trace_extra
+ * lket.5.in: delete the description of backtrace in
+ LKET
+
2006-06-08 Thang P Nguyen <thang.p.nguyen@intel.com>
* testsuite/buildok/ioblock_test.stp: test ioblock
diff --git a/lket.5.in b/lket.5.in
index d98092a4..ff75c19c 100644
--- a/lket.5.in
+++ b/lket.5.in
@@ -215,19 +215,6 @@ Data format is:
.I netdev_name, data_length, protocol, buffer_length
-.SH BACKTRACE
-
-You should use lket_backtrace() function to log backtrace for
-different events.
-
-It's simple to log backtrace, e.g:
-.SAMPLE
-probe addevent.scsi.ioentry
-{
- lket_backtrace()
-}
-.ESAMPLE
-
.SH TRACE DATA FORMAT
By default, LKET will log the trace data in binary format.
diff --git a/parse.cxx b/parse.cxx
index a6a90412..6a565cf4 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -2090,23 +2090,13 @@ parser::parse_symbol ()
else if (name.size() > 0 && (name == "print"
|| name == "sprint"
|| name == "printf"
- || name == "sprintf"
- || name == "lket_trace_extra"))
+ || name == "sprintf"))
{
print_format *fmt = new print_format;
fmt->tok = t;
fmt->print_with_format = (name[name.size() - 1] == 'f');
fmt->print_to_stream = (name[0] == 'p');
- fmt->lket_trace_extra = false;
-
- if(name == "lket_trace_extra")
- {
- fmt->print_with_format = true;
- fmt->print_to_stream = true;
- fmt->lket_trace_extra = true;
- }
-
expect_op("(");
if (fmt->print_with_format)
{
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index ef555303..1e4c23d1 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-09 Li Guanglei <guanglei@cn.ibm.com>
+
+ * lket/b2a/lket_b2a.c, lket/b2a/lket_b2a.h: Rewrite
+ according to the latest LKET's tapsets. Make it able
+ to read the metainfo wrote by tapsets.
+
2006-06-02 Li Guanglei <guanglei@cn.ibm.com>
* lket/b2a/lket_b2a.c: eliminate some compile warnings
diff --git a/runtime/lket/b2a/lket_b2a.c b/runtime/lket/b2a/lket_b2a.c
index 91528f07..461a553e 100644
--- a/runtime/lket/b2a/lket_b2a.c
+++ b/runtime/lket/b2a/lket_b2a.c
@@ -20,9 +20,6 @@
static long long start_timestamp;
-/* mapping table for [group, id, fmt] */
-int **groups[MAX_HOOKGROUP+1] = {NULL};
-
/* Balanced binary search tree to store the
mapping of <pid, process name> */
GTree *appNameTree;
@@ -31,32 +28,8 @@ GTree *appNameTree;
* default hook format table,
* based on tapsets/hookid_defs.stp and other hook specific files
*/
-static hook_fmt default_hook_fmts[] = {
- //_GROUP_SYSCALL
- {1, 1, "%s"}, //HOOKID_SYSCALL_ENTRY
- {1, 2, "%s"}, //HOOKID_SYSCALL_RETURN
- //_GROUP_PROCESS
- {2, 1, "%4b%s"},//HOOKID_PROCESS_SNAPSHOT
- {2, 2, "%s"}, //HOOKID_PROCESS_EXECVE
- {2, 3, "%4b"}, //HOOKID_PROCESS_FORK
- //_GROUP_IOSCHED
- {3, 1, "%s%1b%1b"}, //HOOKID_IOSCHED_NEXT_REQ
- {3, 2, "%s%1b%1b"}, //HOOKID_IOSCHED_ADD_REQ
- {3, 3, "%s%1b%1b"}, //HOOKID_IOSCHED_REMOVE_REQ
- //_GROUP_TASK
- {4, 1, "%4b%4b%1b"},//HOOKID_TASK_CTXSWITCH
- {4, 2, "%4b"}, //HOOKID_TASK_CPUIDLE
- //_GROUP_SCSI
- {5, 1, "%1b%1b%1b"}, //HOOKID_SCSI_IOENTRY
- {5, 2, "%1b%4b%1b%8b%4b%8b"}, //HOOKID_SCSI_IO_TO_LLD
- {5, 3, "%4b%1b%8b"}, //HOOKID_SCSI_IODONE_BY_LLD
- {5, 4, "%4b%1b%8b%4b"}, //HOOKID_SCSI_IOCOMP_BY_MIDLEVEL
- //_GROUP_PAGEFAULT
- {6, 1, "%8b%1b"}, //HOOKID_PAGEFAULT
- //_GROUP_NETDEV
- {7, 1, "%s%4b%2b%4b"}, //HOOKID_NETDEV_RECEIVE
- {7, 2, "%s%4b%2b%4b"} //HOOKID_NETDEV_TRANSMIT
-};
+//event_desc events_des[MAX_EVT_TYPES][MAX_GRPID][MAX_HOOKID];
+event_desc **events_des[MAX_EVT_TYPES][MAX_GRPID];
int main(int argc, char *argv[])
{
@@ -79,6 +52,7 @@ int main(int argc, char *argv[])
printf("Unable to malloc infps\n");
return 1;
}
+
memset(infps, 0, total_infiles * sizeof(FILE *));
for(i=0; i < total_infiles; i++) {
infps[i] = fopen(argv[i+1], "r");
@@ -102,9 +76,6 @@ int main(int argc, char *argv[])
/* create the search tree */
appNameTree = g_tree_new_full(compareFunc, NULL, NULL, destroyAppName);
- // register all hookdata formats here
- register_formats();
-
// find the lket header
find_init_header(infps, total_infiles, outfp);
@@ -133,15 +104,22 @@ int main(int argc, char *argv[])
do {
// j is the next
if(min) {
- print_pkt_header(outfp, &hdrs[j]);
- if(hdrs[j].hookgroup==2 &&
- (hdrs[j].hookid==1 || hdrs[j].hookid==2))
+ if(hdrs[j].hookgroup==_GROUP_PROCESS &&
+ (hdrs[j].hookid==_HOOKID_PROCESS_SNAPSHOT
+ || hdrs[j].hookid==_HOOKID_PROCESS_EXECVE))
+ {
register_appname(j, infps[j], &hdrs[j]);
-
- // write the remaining content from infd[j] to outfile
- b2a_vsnprintf(get_fmt(hdrs[j].hookgroup, hdrs[j].hookid),
- infps[j], outfp, hdrs[j].size);
+ } else if(hdrs[j].hookgroup==_GROUP_REGEVT) {
+ register_events(hdrs[j].hookid, infps[j],
+ hdrs[j].sys_size);
+ } else {
+ print_pkt_header(outfp, &hdrs[j]);
+ ascii_print(hdrs[j], infps[j], outfp, EVT_SYS);
+ if(hdrs[j].total_size != hdrs[j].sys_size)
+ ascii_print(hdrs[j], infps[j], outfp, EVT_USER);
+ }
+ fgetc_unlocked(infps[j]);
// update hdr[j]
get_pkt_header(infps[j], &hdrs[j]);
}
@@ -166,15 +144,6 @@ failed:
fclose(outfp);
// free all allocated memory space
- for(i=0; i <= MAX_HOOKGROUP; i++) {
- if(groups[i]) {
- for(j=0; j <= MAX_HOOKID; j++)
- if(groups[i][j]) {
- free(groups[i][j]);
- groups[i][j] = NULL;
- }
- }
- }
if(infps)
free(infps);
if(hdrs)
@@ -209,7 +178,7 @@ void register_appname(int i, FILE *fp, lket_pkt_header *phdr)
++len;
}
appname[count]='\0';
- fseek(fp, 0-len, SEEK_CUR);
+ //fseek(fp, 0-len, SEEK_CUR);
} else if (phdr->hookid == 2) { /* process.execve */
pid = phdr->pid;
@@ -221,7 +190,7 @@ void register_appname(int i, FILE *fp, lket_pkt_header *phdr)
++len;
}
appname[count]='\0';
- fseek(fp, 0-len, SEEK_CUR);
+ //fseek(fp, 0-len, SEEK_CUR);
} else {
free(appname);
return;
@@ -242,74 +211,6 @@ void destroyAppName(gpointer data)
free(data);
}
-/* The following are all supporting sub-functions */
-
-/*
- * register one hookdata fmt string for a [hookgroup, hookid] pair
- */
-int register_one_fmt(int hookgroup, int hookid, const char *fmt, size_t maxlen)
-{
- void *ptr;
-
- if(hookgroup < 0 || hookgroup > MAX_HOOKGROUP)
- return -1;
- if(hookid < 0 || hookid > MAX_HOOKID)
- return -1;
- if(!fmt || maxlen <= 0)
- return -1;
- if(groups[hookgroup] == NULL) {
- // allocate hook aray for new group
- ptr = malloc((MAX_HOOKID+1) * sizeof(char *));
- if(!ptr)
- return -1;
- memset(ptr,0,(MAX_HOOKID+1) * sizeof(char *));
- groups[hookgroup] = ptr;
- }
- if(groups[hookgroup][hookid] != NULL) {
- free(groups[hookgroup][hookid]);
- groups[hookgroup][hookid] = NULL;
- }
- assert(groups[hookgroup][hookid] == NULL);
- ptr = malloc(maxlen);
- if(!ptr)
- return -1;
- memset(ptr, 0, maxlen);
- strncpy(ptr, fmt, maxlen);
- groups[hookgroup][hookid] = ptr;
- return 0;
-}
-
-/*
- * initialize all the hookdata fmt strings as required
- * called at the beginning of main()
- */
-void register_formats(void)
-{
- int i, total;
-
- total = sizeof(default_hook_fmts)/sizeof(default_hook_fmts[0]);
- if(total <= 0)
- return;
- for(i=0; i<total; i++)
- register_one_fmt( default_hook_fmts[i].hookgrp,
- default_hook_fmts[i].hookid,
- default_hook_fmts[i].fmt,
- strlen(default_hook_fmts[i].fmt) + 1 );
-}
-
-/*
- * get the format string with [hookgroup, hookid] pair
- */
-const char *get_fmt(int hookgroup, int hookid)
-{
- assert(hookgroup >= 0 && hookgroup <= MAX_HOOKGROUP );
- assert(hookid >= 0 && hookid <= MAX_HOOKID );
- if(groups[hookgroup] && groups[hookgroup][hookid])
- return (const char *)groups[hookgroup][hookid];
- else
- return "<Bad Fmt>";
-}
-
/*
* handle the bothering sequence id generated by systemtap
*/
@@ -383,7 +284,8 @@ int get_pkt_header(FILE *fp, lket_pkt_header *phdr)
if(fread(phdr, 1, sizeof(lket_pkt_header), fp) < sizeof(lket_pkt_header))
goto bad;
- phdr->size -= sizeof(lket_pkt_header)-sizeof(phdr->flag)-sizeof(phdr->size)-1;
+ phdr->sys_size -= sizeof(lket_pkt_header)-sizeof(phdr->total_size)-sizeof(phdr->sys_size);
+ phdr->total_size -= sizeof(lket_pkt_header)-sizeof(phdr->total_size)-sizeof(phdr->sys_size);
return 0;
@@ -399,7 +301,7 @@ void print_pkt_header(FILE *fp, lket_pkt_header *phdr)
{
if(!fp || !phdr)
return;
- fprintf(fp, "%lld.%lld APPNAME: %s PID:%d PPID:%d TID:%d CPU:%d HOOKGRP:%d HOOKID:%d HOOKDATA:",
+ fprintf(fp, "\n%lld.%lld APPNAME: %s PID:%d PPID:%d TID:%d CPU:%d HOOKGRP:%d HOOKID:%d -- ",
(phdr->sec*1000000LL + phdr->usec - start_timestamp)/1000000LL,
(phdr->sec*1000000LL + phdr->usec- start_timestamp)%1000000LL,
(char *)(g_tree_lookup(appNameTree, (gconstpointer)((long)phdr->pid))),
@@ -410,170 +312,143 @@ void print_pkt_header(FILE *fp, lket_pkt_header *phdr)
phdr->hookgroup,
phdr->hookid);
}
-static int skip_atoi(const char **s)
+
+void register_events(int evt_type, FILE *infp, size_t size)
{
- int i=0;
- while (isdigit(**s))
- i = i*10 + *((*s)++) - '0';
- return i;
+ int cnt=0, len=0;
+
+ char *evt_body, *evt_fmt, *evt_names, *tmp, *fmt, *name;
+ int8_t grpid, hookid;
+
+ evt_body = malloc(size);
+
+ fread(evt_body, size, 1, infp);
+
+ grpid = *(int8_t *)evt_body;
+ hookid = *(int8_t *)(evt_body+1);
+
+ evt_fmt = evt_body+2;
+
+ for(tmp=evt_fmt; *tmp!=0; tmp++);
+
+ evt_names = tmp+1;
+
+ fmt = strsep(&evt_fmt, ":");
+ name = strsep(&evt_names, ":");
+
+ if(fmt==NULL || name==NULL) {
+ printf("error in event format/names string\n");
+ exit(-1);
+ }
+
+ if(events_des[evt_type][grpid] == NULL) {
+ events_des[evt_type][grpid]
+ = malloc(sizeof(event_desc *)*MAX_HOOKID);
+ }
+ if(events_des[evt_type][grpid][hookid] == NULL) {
+ events_des[evt_type][grpid][hookid]
+ = malloc(sizeof(event_desc));
+ }
+
+ while(fmt!=NULL && name!=NULL) {
+ strncpy(events_des[evt_type][grpid][hookid]->evt_fmt[cnt], fmt, 7);
+ strncpy(events_des[evt_type][grpid][hookid]->evt_names[cnt], name, 64);
+ strncpy(events_des[evt_type][grpid][hookid]->fmt+len, get_fmtstr(fmt), 8);
+ len+=strlen(get_fmtstr(fmt));
+ fmt = strsep(&evt_fmt, ":");
+ name = strsep(&evt_names, ":");
+ cnt++;
+ }
+ events_des[evt_type][grpid][hookid]->count = cnt;
+ *(events_des[evt_type][grpid][hookid]->fmt+len)='\0';
+ free(evt_body);
}
-/*
- * read fixed-length from the input binary file and write into
- * the output file, based on the fmt string
- */
-void b2a_vsnprintf(const char *fmt, FILE *infp, FILE *outfile, size_t size)
+char *get_fmtstr(char *fmt)
{
+ if(strncmp(fmt, "INT8", 4) == 0)
+ return "%1b";
+ if(strncmp(fmt, "INT16", 5) == 0)
+ return "%2b";
+ if(strncmp(fmt, "INT32", 5) == 0)
+ return "%4b";
+ if(strncmp(fmt, "INT64", 5) == 0)
+ return "%8b";
+ if(strncmp(fmt, "STRING", 6) == 0)
+ return "%0s";
+ return "";
+}
- int field_width, qualifier;
- int readbytes = 0;
- int c;
+void ascii_print(lket_pkt_header header, FILE *infp, FILE *outfile, int evt_type)
+{
+ int i, c;
int16_t stemp;
int32_t ntemp;
- long ltemp;
long long lltemp;
- short length;
- char format[128];
+ int readbytes = 0;
+ int size;
+
+ char *fmt, *name, *buffer;
+ int grpid = header.hookgroup;
+ int hookid = header.hookid;
+
+
+ if(evt_type == EVT_SYS)
+ size = header.sys_size;
+ else
+ size = header.total_size - header.sys_size;
- if(size <= 0 || !outfile)
+ if(events_des[evt_type][grpid] == NULL)
+ return;
+ if(events_des[evt_type][grpid][hookid] == NULL)
return;
- for(; *fmt; ++fmt) {
-
- if (*fmt != '%') {
- if (readbytes < size) {
- c = fgetc_unlocked(infp);
- ++readbytes;
- fputc_unlocked(*fmt, outfile);
- continue;
- }
- goto filled;
- }
+ if(events_des[evt_type][grpid][hookid]->count <= 0 || !outfile)
+ return;
- ++fmt;
- qualifier = -1;
- if (*fmt == 'l' || *fmt == 'L') {
- qualifier = *fmt;
- ++fmt;
- if (qualifier == 'l' && *fmt == 'l') {
- qualifier = 'L';
- ++fmt;
- }
- }
+ if(events_des[evt_type][grpid][hookid]->evt_fmt[0][0] == '\0') {
+ //no format is provided, dump in hex
+ buffer = malloc(size);
+ fread(buffer, size, 1, infp);
+ fwrite(buffer, size, 1, outfile);
+ return;
+ }
- field_width = -1;
- if (isdigit(*fmt))
- field_width = skip_atoi(&fmt);
-
- switch (*fmt) {
- case 's':
- c = fgetc_unlocked(infp);
- ++readbytes;
- while (c && readbytes < size) {
- fputc_unlocked(c, outfile);
- c = fgetc_unlocked(infp);
- ++readbytes;
- }
- if(!c) {
- fputc_unlocked(' ', outfile);
- continue;
- }
- else
- goto filled;
- case 'd':
- case 'i':
- if (qualifier == 'l') {
- if(readbytes + sizeof(long) > size)
- goto filled;
- fread(&ltemp, sizeof(long), 1, infp);
- readbytes += sizeof(long);
- fprintf(outfile,"%ld ", (long)ltemp);
- }
- else if (qualifier == 'L') {
- if(readbytes + sizeof(long long) > size)
- goto filled;
- fread(&lltemp, sizeof(int64_t), 1, infp);
- readbytes += sizeof(long long);
- fprintf(outfile,"%lld ", lltemp);
- }
- else {
- if(readbytes + 4 > size)
- goto filled;
- fread(&ntemp, 4, 1, infp);
- readbytes += 4;
- fprintf(outfile,"%d ", (int32_t)ntemp);
- }
- break;
- case 'b':
- if(field_width != 1 && field_width != 2
- && field_width != 4 && field_width != 8)
- field_width = 4;
- if(readbytes + field_width > size)
- goto filled;
-
- //read(infd, &temp, field_width);
- switch(field_width) {
- case 1:
- c = fgetc_unlocked(infp);
- fprintf(outfile, "%d ", (int8_t)c);
- break;
- case 2:
- fread(&stemp, 2, 1, infp);
- fprintf(outfile, "%d ", (int16_t)stemp);
- break;
- case 8:
- fread(&lltemp, 8, 1, infp);
- fprintf(outfile, "%lld ",lltemp);
- break;
- case 4:
- default:
- fread(&ntemp, 4, 1, infp);
- fprintf(outfile, "%d ", (int32_t)ntemp);
- break;
- }
- readbytes += field_width;
- break;
- default:
- if(readbytes >= size)
- goto filled;
+ for(i=0; i<events_des[evt_type][grpid][hookid]->count; i++) {
+ fmt = events_des[evt_type][grpid][hookid]->evt_fmt[i];
+ name = events_des[evt_type][grpid][hookid]->evt_names[i];
+ fwrite(name, strlen(name), 1, outfile);
+ fwrite(":", 1, 1, outfile);
+ if(strncmp(fmt, "INT8", 4)==0) {
+ c = fgetc_unlocked(infp);
+ fprintf(outfile, "%d,", (int8_t)c);
+ readbytes+=1;
+ } else if(strncmp(fmt, "INT16", 5)==0) {
+ fread(&stemp, 2, 1, infp);
+ fprintf(outfile, "%d,", (int16_t)stemp);
+ readbytes+=2;
+ } else if(strncmp(fmt, "INT32", 5)==0) {
+ fread(&ntemp, 4, 1, infp);
+ fprintf(outfile, "%d,", (int32_t)ntemp);
+ readbytes+=4;
+ } else if(strncmp(fmt, "INT64", 5)==0) {
+ fread(&lltemp, 8, 1, infp);
+ fprintf(outfile, "%lld,",lltemp);
+ readbytes+=8;
+ } else if(strncmp(fmt, "STRING", 6)==0) {
+ c = fgetc_unlocked(infp);
+ ++readbytes;
+ while (c && readbytes < size) {
+ fputc_unlocked(c, outfile);
c = fgetc_unlocked(infp);
++readbytes;
- fputc_unlocked(c, outfile);
- if (*fmt) {
- if( readbytes >= size)
- goto filled;
- c = fgetc_unlocked(infp);
- ++readbytes;
- fputc_unlocked(c, outfile);
- } else {
- --fmt;
- }
+ }
+ if(!c) {
+ fputc_unlocked(',', outfile);
continue;
+ }
+ else
+ return;
}
}
-
-filled:
-
- readbytes = 0;
-
- c=fgetc_unlocked(infp);
-
- if(c == LKET_PKT_BT) {
- fread(&length, 2, 1, infp);
- strncpy(format, "BACKTRACE: ", 12);
- fwrite(format, 11, 1, outfile);
- strncpy(format, "%0s", 4);
- b2a_vsnprintf(format, infp, outfile, length);
- } else if(c == LKET_PKT_USER) {
- fread(&length, 2, 1, infp);
- strncpy(format, "USER: ", 6);
- fwrite(format, 6, 1, outfile);
- do {
- c = fgetc_unlocked(infp);
- format[readbytes++] = c;
- } while(c);
- b2a_vsnprintf(format, infp, outfile, length - readbytes);
- } else {
- fputc_unlocked('\n', outfile);
- }
}
diff --git a/runtime/lket/b2a/lket_b2a.h b/runtime/lket/b2a/lket_b2a.h
index 94d1d8b2..1dbfae53 100644
--- a/runtime/lket/b2a/lket_b2a.h
+++ b/runtime/lket/b2a/lket_b2a.h
@@ -5,22 +5,62 @@
#define LKET_MAGIC 0xAEFCDB6B
#define MAX_STRINGLEN 256
-#define MAX_HOOKGROUP 255
-#define MAX_HOOKID 255
#define APPNAMELIST_LEN 256
#define SEQID_SIZE 4
-#define LKET_PKT_SYS 1
-#define LKET_PKT_BT 2
-#define LKET_PKT_USER 3
+#define EVT_SYS 1
+#define EVT_USER 2
+
+#define MAX_GRPID 255
+#define MAX_HOOKID 255
+#define MAX_EVT_TYPES 2
#define DEFAULT_OUTFILE_NAME "lket.out"
+
+/* Group ID Definitions */
+int _GROUP_REGEVT = 1;
+int _GROUP_SYSCALL = 2;
+int _GROUP_PROCESS = 3;
+int _GROUP_IOSCHED = 4;
+int _GROUP_TASK = 5;
+int _GROUP_SCSI = 6;
+int _GROUP_PAGEFAULT = 7;
+int _GROUP_NETDEV = 8;
+
+/* hookIDs defined inside each group */
+int _HOOKID_REGSYSEVT = 1;
+int _HOOKID_REGUSREVT = 2;
+
+int _HOOKID_SYSCALL_ENTRY = 1;
+int _HOOKID_SYSCALL_RETURN = 2;
+
+int _HOOKID_PROCESS_SNAPSHOT = 1;
+int _HOOKID_PROCESS_EXECVE = 2;
+int _HOOKID_PROCESS_FORK = 3;
+
+int _HOOKID_IOSCHED_NEXT_REQ = 1;
+int _HOOKID_IOSCHED_ADD_REQ = 2;
+int _HOOKID_IOSCHED_REMOVE_REQ = 3;
+
+int _HOOKID_TASK_CTXSWITCH = 1;
+int _HOOKID_TASK_CPUIDLE = 2;
+
+int _HOOKID_SCSI_IOENTRY = 1;
+int _HOOKID_SCSI_IO_TO_LLD = 2;
+int _HOOKID_SCSI_IODONE_BY_LLD = 3;
+int _HOOKID_SCSI_IOCOMP_BY_MIDLEVEL = 4;
+
+int _HOOKID_PAGEFAULT = 1;
+
+int _HOOKID_NETDEV_RECEIVE = 1;
+int _HOOKID_NETDEV_TRANSMIT = 2;
+
typedef struct _lket_pkt_header {
- int8_t flag;
- int16_t size;
+ int16_t total_size;
+ int16_t sys_size;
int8_t hookgroup;
int8_t hookid;
int32_t sec;
@@ -39,27 +79,12 @@ typedef struct _appname_info {
struct _appname_info *next;
} appname_info;
-typedef struct _hook_fmt {
- int hookgrp;
- int hookid;
- const char *fmt;
-} hook_fmt;
-
-/*
- * register one hookdata fmt string for a [hookgroup, hookid] pair
- */
-static int register_one_fmt(int hookgroup, int hookid, const char *fmt, size_t maxlen);
-
-/*
- * initialize all the hookdata fmt strings as required
- * called at the beginning of main()
- */
-static void register_formats(void);
-
-/*
- * get the format string with [hookgroup, hookid] pair
- */
-static const char *get_fmt(int hookgroup, int hookid);
+typedef struct {
+ char evt_fmt[256][7]; /* e.g. INT8,STRING,INT16,... */
+ char evt_names[256][64]; /* e.g. protocal,dev_name,buff_len,... */
+ char fmt[256]; /* e.g. %1b,%0s,%2b,... */
+ int count;
+} event_desc;
/*
* handle the bothering sequence id generated by systemtap
@@ -81,20 +106,11 @@ static int get_pkt_header(FILE *fp, lket_pkt_header *phdr);
*/
static void print_pkt_header(FILE *fp, lket_pkt_header *phdr);
-/*
- * Get the appropriate appname index based on the [pid, ppid, tid] triple
- * If exists, return it; otherwise, assigned a new one.
- */
-//static long appname_index(int pid, int ppid, int tid);
-
-/*
- * read fixed-length from the input binary file and write into
- * the output file, based on the fmt string
- */
-static void b2a_vsnprintf(const char *fmt, FILE *infp, FILE *outfile, size_t size);
-
void register_appname(int i, FILE *fp, lket_pkt_header *phdr);
gint compareFunc(gconstpointer a, gconstpointer b, gpointer user_data);
void destroyAppName(gpointer data);
+void register_events(int evt_type, FILE *infp, size_t size);
+void ascii_print(lket_pkt_header header, FILE *infp, FILE *outfile, int evt_type);
+char *get_fmtstr(char *fmt);
#endif
diff --git a/staptree.cxx b/staptree.cxx
index 5b9798df..36712c12 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -626,7 +626,6 @@ void print_format::print (ostream& o) const
string name = (string(print_to_stream ? "" : "s")
+ string("print")
+ string(print_with_format ? "f" : ""));
- if(lket_trace_extra) name="lket_trace_extra";
o << name << "(";
if (print_with_format)
{
@@ -2206,7 +2205,6 @@ deep_copy_visitor::visit_print_format (print_format* e)
n->tok = e->tok;
n->print_with_format = e->print_with_format;
n->print_to_stream = e->print_to_stream;
- n->lket_trace_extra = e->lket_trace_extra;
n->raw_components = e->raw_components;
n->components = e->components;
for (unsigned i = 0; i < e->args.size(); ++i)
diff --git a/staptree.h b/staptree.h
index fc5c590f..9ece20f6 100644
--- a/staptree.h
+++ b/staptree.h
@@ -261,7 +261,6 @@ struct print_format: public expression
{
bool print_with_format;
bool print_to_stream;
- bool lket_trace_extra;
enum format_flag
{
diff --git a/tapset/LKET/Changelog b/tapset/LKET/Changelog
index dbad033f..8680b91a 100644
--- a/tapset/LKET/Changelog
+++ b/tapset/LKET/Changelog
@@ -1,3 +1,9 @@
+2006-06-09 Li Guanglei <guanglei@cn.ibm.com>
+
+ * *.stp: New design of making user able to append extra trace data.
+ lket_backtrace() is deleted.
+ * register_event.stp: write the metainfo of trace data.
+
2006-06-01 Li Guanglei <guanglei@cn.ibm.com>
* *.stp: make user able to append extra trace data. The
diff --git a/tapset/LKET/hookid_defs.stp b/tapset/LKET/hookid_defs.stp
index dc6f7749..70801484 100755
--- a/tapset/LKET/hookid_defs.stp
+++ b/tapset/LKET/hookid_defs.stp
@@ -1,4 +1,9 @@
global
+ /* register event */
+ GROUP_REGEVT,
+ HOOKID_REGSYSEVT,
+ HOOKID_REGUSREVT,
+
/* syscall */
GROUP_SYSCALL,
HOOKID_SYSCALL_ENTRY, HOOKID_SYSCALL_RETURN,
@@ -33,15 +38,19 @@ global
/* used in embedded c codes */
/* Group ID Definitions */
-int _GROUP_SYSCALL = 1;
-int _GROUP_PROCESS = 2;
-int _GROUP_IOSCHED = 3;
-int _GROUP_TASK = 4;
-int _GROUP_SCSI = 5;
-int _GROUP_PAGEFAULT = 6;
-int _GROUP_NETDEV = 7;
+int _GROUP_REGEVT = 1;
+int _GROUP_SYSCALL = 2;
+int _GROUP_PROCESS = 3;
+int _GROUP_IOSCHED = 4;
+int _GROUP_TASK = 5;
+int _GROUP_SCSI = 6;
+int _GROUP_PAGEFAULT = 7;
+int _GROUP_NETDEV = 8;
/* hookIDs defined inside each group */
+int _HOOKID_REGSYSEVT = 1;
+int _HOOKID_REGUSREVT = 2;
+
int _HOOKID_SYSCALL_ENTRY = 1;
int _HOOKID_SYSCALL_RETURN = 2;
@@ -68,40 +77,50 @@ int _HOOKID_NETDEV_TRANSMIT = 2;
%}
-probe begin
+function hookid_init()
{
- GROUP_SYSCALL = 1
+ GROUP_REGEVT = 1
+ HOOKID_REGSYSEVT = 1
+ HOOKID_REGUSREVT = 2
+
+ GROUP_SYSCALL = 2
HOOKID_SYSCALL_ENTRY = 1
HOOKID_SYSCALL_RETURN = 2
- GROUP_PROCESS = 2
+ GROUP_PROCESS = 3
HOOKID_PROCESS_SNAPSHOT = 1
HOOKID_PROCESS_EXECVE = 2
HOOKID_PROCESS_FORK = 3
- GROUP_IOSCHED = 3
+ GROUP_IOSCHED = 4
HOOKID_IOSCHED_NEXT_REQ = 1
HOOKID_IOSCHED_ADD_REQ = 2
HOOKID_IOSCHED_REMOVE_REQ = 3
- GROUP_TASK = 4
+ GROUP_TASK = 5
HOOKID_TASK_CTXSWITCH = 1
HOOKID_TASK_CPUIDLE = 2
- GROUP_SCSI = 5
+ GROUP_SCSI = 6
HOOKID_SCSI_IOENTRY = 1
HOOKID_SCSI_IO_TO_LLD = 2
HOOKID_SCSI_IODONE_BY_LLD = 3
HOOKID_SCSI_IOCOMP_BY_MIDLEVEL = 4
- GROUP_PAGEFAULT = 6
+ GROUP_PAGEFAULT = 7
HOOKID_PAGEFAULT = 1
- GROUP_NETDEV = 7
+ GROUP_NETDEV = 8
HOOKID_NETDEV_RECEIVE = 1
HOOKID_NETDEV_TRANSMIT = 2
+}
- lket_trace_init()
+probe begin
+{
+ hookid_init()
+ lket_trace_init()
+ register_sys_events()
+ write_events_desc()
process_snapshot()
}
diff --git a/tapset/LKET/ioscheduler.stp b/tapset/LKET/ioscheduler.stp
index 462e3758..298ae72b 100755
--- a/tapset/LKET/ioscheduler.stp
+++ b/tapset/LKET/ioscheduler.stp
@@ -6,14 +6,21 @@
// later version.
probe addevent.ioscheduler
- = addevent.ioscheduler.elv_next_request,
- addevent.ioscheduler.elv_completed_request,
- addevent.ioscheduler.elv_add_request
+ = addevent.ioscheduler.elv_next_request,
+ addevent.ioscheduler.elv_add_request,
+ addevent.ioscheduler.elv_completed_request
{
}
+
/* when a request is retrieved from request queue */
probe addevent.ioscheduler.elv_next_request
+ += _addevent.ioscheduler.elv_next_request
+{
+ update_record()
+}
+
+probe _addevent.ioscheduler.elv_next_request
= ioscheduler.elv_next_request
{
if(filter_by_pid() == 1 ) {
@@ -24,6 +31,12 @@ probe addevent.ioscheduler.elv_next_request
/* when a request is added to the request queue */
probe addevent.ioscheduler.elv_add_request
+ += _addevent.ioscheduler.elv_add_request
+{
+ update_record()
+}
+
+probe _addevent.ioscheduler.elv_add_request
= ioscheduler.elv_add_request
{
if(filter_by_pid() == 1 ) {
@@ -33,6 +46,12 @@ probe addevent.ioscheduler.elv_add_request
/* when a request is completed */
probe addevent.ioscheduler.elv_completed_request
+ += _addevent.ioscheduler.elv_completed_request
+{
+ update_record()
+}
+
+probe _addevent.ioscheduler.elv_completed_request
= ioscheduler.elv_completed_request
{
if(filter_by_pid() == 1 ) {
diff --git a/tapset/LKET/lket_trace.stp b/tapset/LKET/lket_trace.stp
index 851a3163..eaab216a 100755
--- a/tapset/LKET/lket_trace.stp
+++ b/tapset/LKET/lket_trace.stp
@@ -30,10 +30,7 @@ function lket_trace_header_init()
#define BIG_ENDIAN 0x02
#define BITS_WIDTH 64 /* 32-bit or 64-bit environment*/
-#define LKET_HEADER_LEN 0 /* fake number, bin_write will fill in the
- actual length of trace header */
-
- _stp_printf("%4b%2n%1b%1b%1b%1b", (_FMT_)MAGIC_NUMBER, (_FMT_)LKET_HEADER_LEN,
+ _stp_printf("%4b%2n%1b%1b%1b%1b", (_FMT_)MAGIC_NUMBER,
(_FMT_)LKET_TRACE_VER_MAJOR, (_FMT_)LKET_TRACE_VER_MINOR,
(_FMT_)BIG_ENDIAN, (_FMT_)BITS_WIDTH);
_stp_print_flush();
@@ -50,10 +47,7 @@ function lket_trace_init()
#ifndef __LKET_TRACE__
#define __LKET_TRACE__
-#define LKET_PKT_SYS 1
#define LKET_PKT_BT 2
-#define LKET_PKT_USER 3
-
#define MAX_FMT_LEN 128
char new_sysfmt[MAX_FMT_LEN] = "\n%d|%d|%d|%d|%d|%d|%d|%d";
@@ -140,30 +134,21 @@ static inline int this_event_len(void)
#define _lket_trace(GroupID, hookID, fmt, args...) do { \
struct timeval tv; \
do_gettimeofday (&tv); \
- _stp_printf("%1b%2n%1b%1b%4b%4b%4b%4b%4b%1b"fmt, \
- (_FMT_)LKET_PKT_SYS, (_FMT_)GroupID, (_FMT_)hookID, \
+ _stp_printf("%2b%2n%1b%1b%4b%4b%4b%4b%4b%1b"fmt, \
+ (_FMT_)0, (_FMT_)GroupID, (_FMT_)hookID, \
(_FMT_)tv.tv_sec, (_FMT_)tv.tv_usec, (_FMT_)current->tgid, \
(_FMT_)current->parent->pid, (_FMT_)current->pid, \
(_FMT_)current->thread_info->cpu, args);\
} while(0)
-#define _lket_trace_extra(fmt, args...) do {\
- _stp_printf("%1b%2n%0s"fmt, (_FMT_)LKET_PKT_USER, fmt, args);\
-} while(0)
-
#endif
#endif
%}
-function lket_backtrace () %{
- if (CONTEXT->regs) {
- String str = _stp_string_init (0);
- _stp_stack_sprint (str, CONTEXT->regs, 0);
-#if defined(ASCII_TRACE)
- _stp_printf("|BACKTRACE: %s", _stp_string_ptr(str));
-#else
- _stp_printf("%1b%2n%0s", (_FMT_)LKET_PKT_BT, _stp_string_ptr(str));
-#endif
- }
+function update_record()
+%{
+ int cpu = smp_processor_id();
+ char *total_length = &_stp_pbuf[cpu][STP_PRINT_BUF_START];
+ *(int16_t *)total_length = _stp_pbuf_len[cpu] - 4;
%}
diff --git a/tapset/LKET/netdev.stp b/tapset/LKET/netdev.stp
index 024e869c..e19c851d 100755
--- a/tapset/LKET/netdev.stp
+++ b/tapset/LKET/netdev.stp
@@ -10,12 +10,18 @@
%}
probe addevent.netdev
- = addevent.netdev.receive, addevent.netdev.transmit
-{
-}
+ = addevent.netdev.receive,
+ addevent.netdev.transmit
+{}
/* Main device receive routine, be called when packet arrives on network device */
probe addevent.netdev.receive
+ += _addevent.netdev.receive
+{
+ update_record()
+}
+
+probe _addevent.netdev.receive
= netdev.receive
{
/* no need to filter by pid */
@@ -24,6 +30,12 @@ probe addevent.netdev.receive
/* Queue a buffer for transmission to a network device */
probe addevent.netdev.transmit
+ += _addevent.netdev.transmit
+{
+ update_record()
+}
+
+probe _addevent.netdev.transmit
= netdev.transmit
{
if(filter_by_pid() == 1 ) {
diff --git a/tapset/LKET/pagefault.stp b/tapset/LKET/pagefault.stp
index 0675f4e8..3f15cf62 100755
--- a/tapset/LKET/pagefault.stp
+++ b/tapset/LKET/pagefault.stp
@@ -13,6 +13,12 @@ function log_pagefault_tracedata(var_id:long, var_addr:long, var_rwflag:long)
/* Record the page fault event */
probe addevent.pagefault
+ += _addevent.pagefault
+{
+ update_record()
+}
+
+probe _addevent.pagefault
= pagefault
{
if(filter_by_pid() == 1 ) {
diff --git a/tapset/LKET/process.stp b/tapset/LKET/process.stp
index 9a8e2196..3155e5dc 100755
--- a/tapset/LKET/process.stp
+++ b/tapset/LKET/process.stp
@@ -30,6 +30,8 @@ function process_snapshot()
%{
struct task_struct *tsk;
struct list_head *cur, *head;
+ int cpu = smp_processor_id();
+ char *total_length;
head = &(current->tasks);
/* iterate all the processes, and record the pid and process
@@ -38,21 +40,29 @@ function process_snapshot()
tsk = (struct task_struct *)(list_entry(cur, struct task_struct, tasks));
_lket_trace(_GROUP_PROCESS, _HOOKID_PROCESS_SNAPSHOT, "%4b%0s",
(_FMT_)tsk->pid, tsk->comm);
+
+ total_length = &_stp_pbuf[cpu][STP_PRINT_BUF_START];
+ *(int16_t *)total_length = _stp_pbuf_len[cpu] - 4;
_stp_print_flush();
}
%}
-
probe addevent.process
- = addevent.process.fork, addevent.process.execve
-{
-}
+ = addevent.process.execve,
+ addevent.process.fork
+{}
/*
we should capture both do_execve for 64-bit app
and compat_do_execve for 32-bit app
*/
probe addevent.process.execve
+ += _addevent.process.execve
+{
+ update_record()
+}
+
+probe _addevent.process.execve
= process.exec
{
if(filter_by_pid() == 1 ) {
@@ -61,6 +71,12 @@ probe addevent.process.execve
}
probe addevent.process.fork
+ += _addevent.process.fork
+{
+ update_record()
+}
+
+probe _addevent.process.fork
= process.create
{
if(filter_by_pid() == 1 ) {
diff --git a/tapset/LKET/register_event.stp b/tapset/LKET/register_event.stp
new file mode 100755
index 00000000..3150bf51
--- /dev/null
+++ b/tapset/LKET/register_event.stp
@@ -0,0 +1,164 @@
+// Copyright (C) 2006 IBM Corp.
+//
+// This file is part of systemtap, and is free software. You can
+// redistribute it and/or modify it under the terms of the GNU General
+// Public License (GPL); either version 2, or (at your option) any
+// later version.
+
+global evt_name, evt_fmt
+global usr_evt_name, usr_evt_fmt
+
+%{
+
+#define _MAXGROUPID 20
+#define _MAXHOOKID 20
+
+int get_fmtcode(char *fmt)
+{
+ if(strncmp(fmt, "INT8", 4) != 0 &&
+ strncmp(fmt, "INT16", 5) != 0 &&
+ strncmp(fmt, "INT32", 5) != 0 &&
+ strncmp(fmt, "INT64", 5) != 0 &&
+ strncmp(fmt, "STRING", 6) != 0)
+ return -1;
+ else
+ return 0;
+}
+
+%}
+
+function dummy_c_function()
+%{
+%}
+
+function register_user_event(grpid:long, hookid:long,fmt:string, name:string)
+{
+ usr_evt_fmt[grpid, hookid] = fmt
+ usr_evt_name[grpid, hookid] = name
+ dummy_c_function() /* ensure register_user_event won't be compiled away */
+}
+
+function register_sys_event(grpid:long, hookid:long,fmt:string, name:string)
+{
+ evt_fmt[grpid, hookid] = fmt
+ evt_name[grpid, hookid] = name
+ dummy_c_function() /* ensure register_user_event won't be compiled away */
+}
+
+
+function write_events_desc()
+{
+ foreach([grpid, hookid] in evt_fmt)
+ {
+ register_event(grpid, hookid, HOOKID_REGSYSEVT,
+ evt_fmt[grpid, hookid], evt_name[grpid, hookid])
+ }
+ foreach([grpid, hookid] in usr_evt_fmt)
+ {
+ register_event(grpid, hookid, HOOKID_REGUSREVT,
+ usr_evt_fmt[grpid, hookid], usr_evt_name[grpid, hookid])
+ }
+
+ delete evt_name
+ delete evt_fmt
+ delete usr_evt_name
+ delete usr_evt_fmt
+}
+
+function register_event(grpid:long, hookid:long, evt_type:long, fmt:string, names:string)
+%{
+ char in_fmt[512], in_name[512];
+ char *p_in_fmt, *p_in_name;
+ char *fmt, *name;
+ int cpu = smp_processor_id();
+ char *total_length;
+ p_in_fmt = in_fmt;
+ p_in_name = in_name;
+
+ if(THIS->fmt==NULL || THIS->names==NULL) {
+ _stp_warn("error fmt/names in register_user_event\n");
+ _stp_exit();
+ }
+
+ if( THIS->grpid <= 0 || THIS->grpid > _MAXGROUPID ||
+ THIS->hookid <= 0 || THIS->hookid > _MAXHOOKID) {
+ _stp_warn("wrong range in groupid/hookid\n");
+ _stp_exit();
+ }
+
+ strncpy(in_fmt, THIS->fmt, 512);
+ strncpy(in_name, THIS->names, 512);
+
+ fmt = strsep(&p_in_fmt, ":");
+ name = strsep(&p_in_name, ":");
+
+ while(fmt!=NULL && name!=NULL) {
+ if(get_fmtcode(fmt) == -1) {
+ _stp_warn("error in fmt string\n");
+ _stp_exit();
+ }
+ fmt = strsep(&p_in_fmt, ":");
+ name = strsep(&p_in_name, ":");
+ }
+
+ if(fmt!=NULL || name != NULL) {
+ _stp_warn("unpaired types/names\n");
+ _stp_exit();
+ }
+
+ _lket_trace(_GROUP_REGEVT, THIS->evt_type, "%1b%1b%0s%0s", THIS->grpid,
+ THIS->hookid, THIS->fmt, THIS->names);
+
+ total_length = &_stp_pbuf[cpu][STP_PRINT_BUF_START];
+ *(int16_t *)total_length = _stp_pbuf_len[cpu] - 4;
+
+ _stp_print_flush();
+%}
+
+function register_sys_events()
+{
+ register_sys_event(GROUP_SYSCALL, HOOKID_SYSCALL_ENTRY, "STRING", "Syscall")
+ register_sys_event(GROUP_SYSCALL, HOOKID_SYSCALL_RETURN, "STRING", "Syscall")
+
+ register_sys_event(GROUP_PROCESS, HOOKID_PROCESS_SNAPSHOT,
+ "INT32:STRING", "PID:PNAME")
+ register_sys_event(GROUP_PROCESS, HOOKID_PROCESS_EXECVE,
+ "STRING", "PNAME")
+ register_sys_event(GROUP_PROCESS, HOOKID_PROCESS_FORK,
+ "INT32", "PID")
+
+ register_sys_event(GROUP_IOSCHED, HOOKID_IOSCHED_NEXT_REQ,
+ "STRING:INT8:INT8", "ELV_NAME:MAJOR:MINOR")
+ register_sys_event(GROUP_IOSCHED, HOOKID_IOSCHED_ADD_REQ,
+ "STRING:INT8:INT8", "ELV_NAME:MAJOR:MINOR")
+ register_sys_event(GROUP_IOSCHED, HOOKID_IOSCHED_REMOVE_REQ,
+ "STRING:INT8:INT8", "ELV_NAME:MAJOR:MINOR")
+
+ register_sys_event(GROUP_TASK, HOOKID_TASK_CTXSWITCH,
+ "INT32:INT32:INT8", "Prev_PID:Next_PID:Prev_State")
+ register_sys_event(GROUP_TASK, HOOKID_TASK_CPUIDLE,
+ "INT32", "CurrPID")
+
+ register_sys_event(GROUP_SCSI, HOOKID_SCSI_IOENTRY,
+ "INT8:INT8:INT8", "MAJOR:MINOR:SDEV_STATE")
+ register_sys_event(GROUP_SCSI, HOOKID_SCSI_IO_TO_LLD,
+ "INT8:INT32:INT8:INT64:INT32:INT64",
+ "SDEV_STATE:SCSI_INFO:Data_Dir:Req_Buf:Buf_Len:Cmd_ID")
+ register_sys_event(GROUP_SCSI, HOOKID_SCSI_IODONE_BY_LLD,
+ "INT32:INT8:INT64", "SCSI_INFO:Data_Dir:Cmd_ID")
+ register_sys_event(GROUP_SCSI, HOOKID_SCSI_IOCOMP_BY_MIDLEVEL,
+ "INT32:INT8:INT64:INT32", "SCSI_INFO:Data_Dir:Cmd_ID:Bytes");
+
+ register_sys_event(GROUP_PAGEFAULT, HOOKID_PAGEFAULT,
+ "INT64:INT8", "ADDR:WRITE")
+
+ register_sys_event(GROUP_NETDEV, HOOKID_NETDEV_RECEIVE,
+ "STRING:INT32:INT16:INT32", "DEV_NAME:Data_LEN:Protocol:Buff_Size")
+ register_sys_event(GROUP_NETDEV, HOOKID_NETDEV_TRANSMIT,
+ "STRING:INT32:INT16:INT32", "DEV_NAME:Data_LEN:Protocol:Buff_Size")
+}
+
+probe register_event = begin
+{
+ hookid_init()
+}
diff --git a/tapset/LKET/scsi.stp b/tapset/LKET/scsi.stp
index b98e4346..a9e4e4d9 100755
--- a/tapset/LKET/scsi.stp
+++ b/tapset/LKET/scsi.stp
@@ -28,11 +28,16 @@ probe addevent.scsi
addevent.scsi.iodispatching,
addevent.scsi.iodone,
addevent.scsi.iocompleted
-{
-}
+{}
/* mid-layer prepare a IO request */
probe addevent.scsi.ioentry
+ += _addevent.scsi.ioentry
+{
+ update_record()
+}
+
+probe _addevent.scsi.ioentry
= scsi.ioentry
{
log_scsi_ioentry(HOOKID_SCSI_IOENTRY, $q, $req)
@@ -40,6 +45,12 @@ probe addevent.scsi.ioentry
/* Dispatch a command to the low-level driver. */
probe addevent.scsi.iodispatching
+ += _addevent.scsi.iodispatching
+{
+ update_record()
+}
+
+probe _addevent.scsi.iodispatching
= scsi.iodispatching
{
log_scsi_dispatch(HOOKID_SCSI_IO_TO_LLD, $cmd)
@@ -47,6 +58,12 @@ probe addevent.scsi.iodispatching
/* I/O is done by low-level driver*/
probe addevent.scsi.iodone
+ += _addevent.scsi.iodone
+{
+ update_record()
+}
+
+probe _addevent.scsi.iodone
= scsi.iodone
{
/* scsi timer check. We should record the hook only
@@ -60,6 +77,12 @@ probe addevent.scsi.iodone
/* mid-layer processes the completed IO */
probe addevent.scsi.iocompleted
+ += _addevent.scsi.iocompleted
+{
+ update_record()
+}
+
+probe _addevent.scsi.iocompleted
= scsi.iocompleted
{
log_scsi_iocompleted(HOOKID_SCSI_IOCOMP_BY_MIDLEVEL, $cmd, $good_bytes)
diff --git a/tapset/LKET/syscalls.stp b/tapset/LKET/syscalls.stp
index 7b4f6799..cd6850aa 100755
--- a/tapset/LKET/syscalls.stp
+++ b/tapset/LKET/syscalls.stp
@@ -6,18 +6,17 @@
// later version.
probe addevent.syscall
- = addevent.syscall.entry, addevent.syscall.return
+ = addevent.syscall.entry,
+ addevent.syscall.return
+{}
+
+probe addevent.syscall.entry
+ += _addevent.syscall.entry
{
+ update_record()
}
-/* log the system call name */
-function log_syscall_tracedata(var_id:long, name:string)
-%{
- _lket_trace(_GROUP_SYSCALL, THIS->var_id, "%0s", THIS->name);
-%}
-
-
-probe addevent.syscall.entry
+probe _addevent.syscall.entry
= syscall.*
{
if(filter_by_pid() == 1 ) {
@@ -26,9 +25,23 @@ probe addevent.syscall.entry
}
probe addevent.syscall.return
+ += _addevent.syscall.return
+{
+ update_record()
+}
+
+probe _addevent.syscall.return
= syscall.*.return
{
if(filter_by_pid() == 1 ) {
log_syscall_tracedata(HOOKID_SYSCALL_RETURN, name)
}
}
+
+/* log the system call name */
+function log_syscall_tracedata(var_id:long, name:string)
+%{
+ _lket_trace(_GROUP_SYSCALL, THIS->var_id, "%0s", THIS->name);
+%}
+
+
diff --git a/tapset/LKET/tskdispatch.stp b/tapset/LKET/tskdispatch.stp
index f75c083a..d56e69e7 100755
--- a/tapset/LKET/tskdispatch.stp
+++ b/tapset/LKET/tskdispatch.stp
@@ -15,14 +15,20 @@
* specifying probe points by label. *
* *
**********************************************************/
+
probe addevent.tskdispatch
- = addevent.tskdispatch.ctxswitch,
- addevent.tskdispatch.cpuidle
-{
-}
+ = addevent.tskdispatch.cpuidle,
+ addevent.tskdispatch.ctxswitch
+{}
/* Only applicable to SMP systems */
probe addevent.tskdispatch.cpuidle
+ += _addevent.tskdispatch.cpuidle
+{
+ update_record()
+}
+
+probe _addevent.tskdispatch.cpuidle
= scheduler.balance
{
/* we didn't call filter_by_pid() here,
@@ -32,6 +38,12 @@ probe addevent.tskdispatch.cpuidle
}
probe addevent.tskdispatch.ctxswitch
+ += _addevent.tskdispatch.ctxswitch
+{
+ update_record()
+}
+
+probe _addevent.tskdispatch.ctxswitch
= scheduler.ctxswitch
{
target_pid = target()
diff --git a/translate.cxx b/translate.cxx
index eb64d9d0..967949a4 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -3591,10 +3591,7 @@ c_unparser::visit_print_format (print_format* e)
if (e->print_to_stream)
{
o->newline() << res.qname() << " = 0;";
- if(e->lket_trace_extra)
- o->newline() << "_lket_trace_extra (";
- else
- o->newline() << "_stp_printf (";
+ o->newline() << "_stp_printf (";
}
else
o->newline() << "_stp_snprintf (" << res.qname() << ", MAXSTRINGLEN, ";