提交 84c7a217 编写于 作者: F Frederic Weisbecker

perf: Humanize lock flags in perf lock

Use an enum instead of plain constants for lock flags.
Signed-off-by: NFrederic 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>
上级 10350ec3
...@@ -397,6 +397,11 @@ enum broken_state { ...@@ -397,6 +397,11 @@ enum broken_state {
static int bad_hist[BROKEN_MAX]; static int bad_hist[BROKEN_MAX];
enum acquire_flags {
TRY_LOCK = 1,
READ_LOCK = 2,
};
static void static void
report_lock_acquire_event(struct trace_acquire_event *acquire_event, report_lock_acquire_event(struct trace_acquire_event *acquire_event,
struct event *__event __used, struct event *__event __used,
...@@ -421,9 +426,9 @@ report_lock_acquire_event(struct trace_acquire_event *acquire_event, ...@@ -421,9 +426,9 @@ report_lock_acquire_event(struct trace_acquire_event *acquire_event,
if (!acquire_event->flag) { if (!acquire_event->flag) {
seq->state = SEQ_STATE_ACQUIRING; seq->state = SEQ_STATE_ACQUIRING;
} else { } else {
if (acquire_event->flag & 1) if (acquire_event->flag & TRY_LOCK)
ls->nr_trylock++; ls->nr_trylock++;
if (acquire_event->flag & 2) if (acquire_event->flag & READ_LOCK)
ls->nr_readlock++; ls->nr_readlock++;
seq->state = SEQ_STATE_READ_ACQUIRED; seq->state = SEQ_STATE_READ_ACQUIRED;
seq->read_count = 1; seq->read_count = 1;
...@@ -431,7 +436,7 @@ report_lock_acquire_event(struct trace_acquire_event *acquire_event, ...@@ -431,7 +436,7 @@ report_lock_acquire_event(struct trace_acquire_event *acquire_event,
} }
break; break;
case SEQ_STATE_READ_ACQUIRED: case SEQ_STATE_READ_ACQUIRED:
if (acquire_event->flag & 2) { if (acquire_event->flag & READ_LOCK) {
seq->read_count++; seq->read_count++;
ls->nr_acquired++; ls->nr_acquired++;
goto end; goto end;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册