diff options
author | Jiri Olsa <jolsa@redhat.com> | 2009-09-16 08:45:55 +0200 |
---|---|---|
committer | Jiri Olsa <jolsa@redhat.com> | 2009-09-16 08:45:55 +0200 |
commit | 397b449e4661c749678e26c17bdf77c30bc4130a (patch) | |
tree | c6d81a728e08da6219fe2c171169795e18184213 /src | |
parent | 5e542623f3dafab636adbe5690a8a4716a96f956 (diff) | |
download | latrace-397b449e4661c749678e26c17bdf77c30bc4130a.tar.gz latrace-397b449e4661c749678e26c17bdf77c30bc4130a.tar.xz latrace-397b449e4661c749678e26c17bdf77c30bc4130a.zip |
added support for pipe mode timestamp display
Diffstat (limited to 'src')
-rw-r--r-- | src/audit.c | 10 | ||||
-rw-r--r-- | src/config.h | 5 | ||||
-rw-r--r-- | src/fifo.c | 7 | ||||
-rw-r--r-- | src/run.c | 4 |
4 files changed, 14 insertions, 12 deletions
diff --git a/src/audit.c b/src/audit.c index 2b96f0d..850daac 100644 --- a/src/audit.c +++ b/src/audit.c @@ -80,7 +80,7 @@ static int sym_entry(const char *symname, char *lib_from, char *lib_to, if (cfg.flow_below_cnt && !check_flow_below(symname, 1)) return 0; - if (cfg.sh.timestamp) + if (cfg.sh.timestamp || cfg.sh.counts) gettimeofday(&tv, NULL); argret = cfg.sh.args_enabled ? @@ -93,7 +93,7 @@ static int sym_entry(const char *symname, char *lib_from, char *lib_to, if (!pipe_fd) pipe_fd = lt_fifo_create(&cfg, cfg.dir); - len = lt_fifo_msym_get(&cfg, buf, FIFO_MSG_TYPE_ENTRY, + len = lt_fifo_msym_get(&cfg, buf, FIFO_MSG_TYPE_ENTRY, &tv, (char*) symname, lib_to, argbuf, argdbuf); return lt_fifo_send(&cfg, pipe_fd, buf, len); @@ -125,18 +125,18 @@ static int sym_exit(const char *symname, char *lib_from, char *lib_to, if (cfg.flow_below_cnt && !check_flow_below(symname, 0)) return 0; - if (cfg.sh.timestamp) + if (cfg.sh.timestamp || cfg.sh.counts) gettimeofday(&tv, NULL); argret = cfg.sh.args_enabled ? - lt_args_sym_exit(&cfg.sh, (char*) symname, + lt_args_sym_exit(&cfg.sh, (char*) symname, (La_regs*) inregs, outregs, &argbuf, &argdbuf) : -1; if (cfg.sh.pipe) { char buf[FIFO_MSG_MAXLEN]; int len; - len = lt_fifo_msym_get(&cfg, buf, FIFO_MSG_TYPE_EXIT, + len = lt_fifo_msym_get(&cfg, buf, FIFO_MSG_TYPE_EXIT, &tv, (char*) symname, lib_to, argbuf, argdbuf); return lt_fifo_send(&cfg, pipe_fd, buf, len); diff --git a/src/config.h b/src/config.h index 2aa0595..afd8a7a 100644 --- a/src/config.h +++ b/src/config.h @@ -338,8 +338,9 @@ int lt_fifo_open(struct lt_config_app *cfg, char *name); int lt_fifo_send(struct lt_config_audit *cfg, int fd, char *buf, int len); int lt_fifo_recv(struct lt_config_app *cfg, struct lt_thread *t, void *buf, int bufsize); -int lt_fifo_msym_get(struct lt_config_audit *cfg, char *buf, int type, - char *symname, char *libto, char *arg, char *argd); +int lt_fifo_msym_get(struct lt_config_audit *cfg, char *buf, int type, + struct timeval *tv, char *symname, char *libto, + char *arg, char *argd); /* counts */ int lt_stats_init(struct lt_config_app *cfg); @@ -114,8 +114,9 @@ int lt_fifo_recv(struct lt_config_app *cfg, struct lt_thread *t, void *buf, return 0; } -int lt_fifo_msym_get(struct lt_config_audit *cfg, char *buf, int type, - char *symname, char *libto, char *arg, char *argd) +int lt_fifo_msym_get(struct lt_config_audit *cfg, char *buf, int type, + struct timeval *tv, char *symname, char *libto, + char *arg, char *argd) { struct lt_fifo_msym *m = (struct lt_fifo_msym*) buf; int len_data, len = sizeof(struct lt_fifo_msym); @@ -123,7 +124,7 @@ int lt_fifo_msym_get(struct lt_config_audit *cfg, char *buf, int type, /* TODO need proper buf size checking */ m->h.type = type; m->h.tid = (pid_t) syscall(SYS_gettid); - gettimeofday(&m->h.tv, NULL); + m->h.tv = *tv; m->sym = 0; m->lib = strlen(symname); @@ -133,7 +133,7 @@ static int process_fifo(struct lt_config_app *cfg, struct lt_thread *t) if (FIFO_MSG_TYPE_ENTRY == msym->h.type) { cfg->sh.indent_depth++; - lt_out_entry(&cfg->sh, NULL, + lt_out_entry(&cfg->sh, &msym->h.tv, msym->data + msym->sym, msym->data + msym->lib, msym->data + msym->arg, @@ -141,7 +141,7 @@ static int process_fifo(struct lt_config_app *cfg, struct lt_thread *t) } else if (FIFO_MSG_TYPE_EXIT == msym->h.type) { - lt_out_exit(&cfg->sh, NULL, + lt_out_exit(&cfg->sh, &msym->h.tv, msym->data + msym->sym, msym->data + msym->lib, msym->data + msym->arg, |