diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-11-23 19:22:55 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-11-23 19:22:55 +0100 |
commit | 2f271888d2ed934c271637c22554b503ce68e535 (patch) | |
tree | 3a2c762e4a93a2b0144882007d0061366d63e749 /src/modules/sdlog2 | |
parent | 8ff4da67d5ab7927fb3cc70dbebdce9f99d2133c (diff) | |
download | px4-firmware-2f271888d2ed934c271637c22554b503ce68e535.tar.gz px4-firmware-2f271888d2ed934c271637c22554b503ce68e535.tar.bz2 px4-firmware-2f271888d2ed934c271637c22554b503ce68e535.zip |
Added performance counter for SD log performance of write() call
Diffstat (limited to 'src/modules/sdlog2')
-rw-r--r-- | src/modules/sdlog2/sdlog2.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index af580f1f7..8638a4904 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -496,6 +496,8 @@ static void *logwriter_thread(void *arg) /* set name */ prctl(PR_SET_NAME, "sdlog2_writer", 0); + perf_counter_t perf_write = perf_alloc(PC_ELAPSED, "sd write"); + int log_fd = open_log_file(); if (log_fd < 0) { @@ -553,7 +555,9 @@ static void *logwriter_thread(void *arg) n = available; } + perf_begin(perf_write); n = write(log_fd, read_ptr, n); + perf_end(perf_write); should_wait = (n == available) && !is_part; @@ -586,6 +590,9 @@ static void *logwriter_thread(void *arg) fsync(log_fd); close(log_fd); + /* free performance counter */ + perf_free(perf_write); + return NULL; } |