summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2009-09-16 08:45:55 +0200
committerJiri Olsa <jolsa@redhat.com>2009-09-16 08:45:55 +0200
commit397b449e4661c749678e26c17bdf77c30bc4130a (patch)
treec6d81a728e08da6219fe2c171169795e18184213
parent5e542623f3dafab636adbe5690a8a4716a96f956 (diff)
downloadlatrace-397b449e4661c749678e26c17bdf77c30bc4130a.tar.gz
latrace-397b449e4661c749678e26c17bdf77c30bc4130a.tar.xz
latrace-397b449e4661c749678e26c17bdf77c30bc4130a.zip
added support for pipe mode timestamp display
-rw-r--r--ChangeLog3
-rw-r--r--src/audit.c10
-rw-r--r--src/config.h5
-rw-r--r--src/fifo.c7
-rw-r--r--src/run.c4
5 files changed, 17 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 94f0c61..64c6098 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2009-09-16 Jiri Olsa <olsajiri@gmail.com>
+ * added support for pipe mode timestamp display
+
2009-09-15 Jiri Olsa <olsajiri@gmail.com>
* added initial support for timestamp display
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);
diff --git a/src/fifo.c b/src/fifo.c
index 08aad32..411a00c 100644
--- a/src/fifo.c
+++ b/src/fifo.c
@@ -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);
diff --git a/src/run.c b/src/run.c
index d328964..de714b0 100644
--- a/src/run.c
+++ b/src/run.c
@@ -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,