diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2010-05-05 17:57:25 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-05-09 07:45:27 -0400 |
commit | 84c7a21791eb2e962a27e19bab5b77d5d9e13a34 (patch) | |
tree | f61363b358a58c164b5b457a70e4eb9d0da0fdd1 /tools/perf/builtin-lock.c | |
parent | 10350ec362b48f79f3df8447c25813790075e27c (diff) |
perf: Humanize lock flags in perf lock
Use an enum instead of plain constants for lock flags.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Diffstat (limited to 'tools/perf/builtin-lock.c')
-rw-r--r-- | tools/perf/builtin-lock.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 1e93179c2d30..3b304ed4d2e9 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c | |||
@@ -397,6 +397,11 @@ enum broken_state { | |||
397 | 397 | ||
398 | static int bad_hist[BROKEN_MAX]; | 398 | static int bad_hist[BROKEN_MAX]; |
399 | 399 | ||
400 | enum acquire_flags { | ||
401 | TRY_LOCK = 1, | ||
402 | READ_LOCK = 2, | ||
403 | }; | ||
404 | |||
400 | static void | 405 | static void |
401 | report_lock_acquire_event(struct trace_acquire_event *acquire_event, | 406 | report_lock_acquire_event(struct trace_acquire_event *acquire_event, |
402 | struct event *__event __used, | 407 | struct event *__event __used, |
@@ -421,9 +426,9 @@ report_lock_acquire_event(struct trace_acquire_event *acquire_event, | |||
421 | if (!acquire_event->flag) { | 426 | if (!acquire_event->flag) { |
422 | seq->state = SEQ_STATE_ACQUIRING; | 427 | seq->state = SEQ_STATE_ACQUIRING; |
423 | } else { | 428 | } else { |
424 | if (acquire_event->flag & 1) | 429 | if (acquire_event->flag & TRY_LOCK) |
425 | ls->nr_trylock++; | 430 | ls->nr_trylock++; |
426 | if (acquire_event->flag & 2) | 431 | if (acquire_event->flag & READ_LOCK) |
427 | ls->nr_readlock++; | 432 | ls->nr_readlock++; |
428 | seq->state = SEQ_STATE_READ_ACQUIRED; | 433 | seq->state = SEQ_STATE_READ_ACQUIRED; |
429 | seq->read_count = 1; | 434 | seq->read_count = 1; |
@@ -431,7 +436,7 @@ report_lock_acquire_event(struct trace_acquire_event *acquire_event, | |||
431 | } | 436 | } |
432 | break; | 437 | break; |
433 | case SEQ_STATE_READ_ACQUIRED: | 438 | case SEQ_STATE_READ_ACQUIRED: |
434 | if (acquire_event->flag & 2) { | 439 | if (acquire_event->flag & READ_LOCK) { |
435 | seq->read_count++; | 440 | seq->read_count++; |
436 | ls->nr_acquired++; | 441 | ls->nr_acquired++; |
437 | goto end; | 442 | goto end; |