diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-12-09 11:06:34 -0500 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-12-09 11:09:29 -0500 |
| commit | 7efbfc0d311523468c3b4665cc31d654c4c58a75 (patch) | |
| tree | 3cb109c033b631142512ca412a89409fd972f352 | |
| parent | ae1d5e700bbf4b8b1f1ecfaab69f2ef8d55e3563 (diff) | |
Add -i option to rtspin (report interrupts)
Add an option that, together with -v (verbose), makes rtspin print
interrupt information from its control page.
| -rw-r--r-- | bin/rtspin.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/bin/rtspin.c b/bin/rtspin.c index ea7f192..d8366e3 100644 --- a/bin/rtspin.c +++ b/bin/rtspin.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include <time.h> | 6 | #include <time.h> |
| 7 | #include <string.h> | 7 | #include <string.h> |
| 8 | #include <assert.h> | 8 | #include <assert.h> |
| 9 | 9 | #include <inttypes.h> | |
| 10 | 10 | ||
| 11 | #include "litmus.h" | 11 | #include "litmus.h" |
| 12 | #include "common.h" | 12 | #include "common.h" |
| @@ -184,7 +184,7 @@ static int job(double exec_time, double program_end, int lock_od, double cs_leng | |||
| 184 | } | 184 | } |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | #define OPTSTR "p:c:wlveo:f:s:q:r:X:L:Q:v" | 187 | #define OPTSTR "p:c:wlveo:f:s:q:r:X:L:Q:vi" |
| 188 | int main(int argc, char** argv) | 188 | int main(int argc, char** argv) |
| 189 | { | 189 | { |
| 190 | int ret; | 190 | int ret; |
| @@ -210,6 +210,9 @@ int main(int argc, char** argv) | |||
| 210 | 210 | ||
| 211 | int verbose = 0; | 211 | int verbose = 0; |
| 212 | unsigned int job_no; | 212 | unsigned int job_no; |
| 213 | struct control_page* cp; | ||
| 214 | int report_interrupts = 0; | ||
| 215 | uint64_t last_irq_count = 0; | ||
| 213 | 216 | ||
| 214 | /* locking */ | 217 | /* locking */ |
| 215 | int lock_od = -1; | 218 | int lock_od = -1; |
| @@ -275,6 +278,9 @@ int main(int argc, char** argv) | |||
| 275 | case 'v': | 278 | case 'v': |
| 276 | verbose = 1; | 279 | verbose = 1; |
| 277 | break; | 280 | break; |
| 281 | case 'i': | ||
| 282 | report_interrupts = 1; | ||
| 283 | break; | ||
| 278 | case ':': | 284 | case ':': |
| 279 | usage("Argument missing."); | 285 | usage("Argument missing."); |
| 280 | break; | 286 | break; |
| @@ -361,6 +367,8 @@ int main(int argc, char** argv) | |||
| 361 | if (ret != 0) | 367 | if (ret != 0) |
| 362 | bail_out("could not become RT task"); | 368 | bail_out("could not become RT task"); |
| 363 | 369 | ||
| 370 | cp = get_ctrl_page(); | ||
| 371 | |||
| 364 | if (protocol >= 0) { | 372 | if (protocol >= 0) { |
| 365 | /* open reference to semaphore */ | 373 | /* open reference to semaphore */ |
| 366 | lock_od = litmus_open_lock(protocol, resource_id, lock_namespace, &cluster); | 374 | lock_od = litmus_open_lock(protocol, resource_id, lock_namespace, &cluster); |
| @@ -392,6 +400,14 @@ int main(int argc, char** argv) | |||
| 392 | get_job_no(&job_no); | 400 | get_job_no(&job_no); |
| 393 | printf("rtspin/%d:%u @ %.4fms\n", gettid(), | 401 | printf("rtspin/%d:%u @ %.4fms\n", gettid(), |
| 394 | job_no, (wctime() - start) * 1000); | 402 | job_no, (wctime() - start) * 1000); |
| 403 | if (report_interrupts && cp) { | ||
| 404 | uint64_t irq = cp->irq_count; | ||
| 405 | |||
| 406 | printf("\ttotal interrupts: %" PRIu64 | ||
| 407 | "; delta: %" PRIu64 "\n", | ||
| 408 | irq, irq - last_irq_count); | ||
| 409 | last_irq_count = irq; | ||
| 410 | } | ||
| 395 | } | 411 | } |
| 396 | /* convert to seconds and scale */ | 412 | /* convert to seconds and scale */ |
| 397 | } while (job(wcet_ms * 0.001 * scale, start + duration, | 413 | } while (job(wcet_ms * 0.001 * scale, start + duration, |
