Linux Perf
|
#include <errno.h>
#include <inttypes.h>
#include "builtin.h"
#include "perf.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/util.h"
#include "util/cache.h"
#include "util/symbol.h"
#include "util/thread.h"
#include "util/header.h"
#include <subcmd/parse-options.h>
#include "util/trace-event.h"
#include "util/debug.h"
#include "util/session.h"
#include "util/tool.h"
#include "util/data.h"
#include <sys/types.h>
#include <sys/prctl.h>
#include <semaphore.h>
#include <pthread.h>
#include <math.h>
#include <limits.h>
#include <linux/list.h>
#include <linux/hash.h>
#include <linux/kernel.h>
Go to the source code of this file.
Classes | |
struct | lock_stat |
struct | lock_seq_stat |
struct | thread_stat |
struct | lock_key |
struct | trace_lock_handler |
Macros | |
#define | LOCKHASH_BITS 12 |
#define | LOCKHASH_SIZE (1UL << LOCKHASH_BITS) |
#define | __lockhashfn(key) hash_long((unsigned long)key, LOCKHASH_BITS) |
#define | lockhashentry(key) (lockhash_table + __lockhashfn((key))) |
#define | SEQ_STATE_UNINITIALIZED 0 /* initial state */ |
#define | SEQ_STATE_RELEASED 1 |
#define | SEQ_STATE_ACQUIRING 2 |
#define | SEQ_STATE_ACQUIRED 3 |
#define | SEQ_STATE_READ_ACQUIRED 4 |
#define | SEQ_STATE_CONTENDED 5 |
#define | MAX_LOCK_DEPTH 48 |
#define | SINGLE_KEY(member) |
#define | DEF_KEY_LOCK(name, fn_suffix) { #name, lock_stat_key_ ## fn_suffix } |
Typedefs | |
typedef int(* | tracepoint_handler) (struct perf_evsel *evsel, struct perf_sample *sample) |
Enumerations | |
enum | broken_state { BROKEN_ACQUIRE, BROKEN_ACQUIRED, BROKEN_CONTENDED, BROKEN_RELEASE, BROKEN_MAX } |
enum | acquire_flags { TRY_LOCK = 1, READ_LOCK = 2 } |
Functions | |
static struct thread_stat * | thread_stat_find (u32 tid) |
static void | thread_stat_insert (struct thread_stat *new) |
static struct thread_stat * | thread_stat_findnew_after_first (u32 tid) |
static struct thread_stat * | thread_stat_findnew_first (u32 tid) |
static int | lock_stat_key_wait_time_min (struct lock_stat *one, struct lock_stat *two) |
static int | select_key (void) |
static void | insert_to_result (struct lock_stat *st, int(*bigger)(struct lock_stat *, struct lock_stat *)) |
static struct lock_stat * | pop_from_result (void) |
static struct lock_stat * | lock_stat_findnew (void *addr, const char *name) |
static struct lock_seq_stat * | get_seq (struct thread_stat *ts, void *addr) |
static int | report_lock_acquire_event (struct perf_evsel *evsel, struct perf_sample *sample) |
static int | report_lock_acquired_event (struct perf_evsel *evsel, struct perf_sample *sample) |
static int | report_lock_contended_event (struct perf_evsel *evsel, struct perf_sample *sample) |
static int | report_lock_release_event (struct perf_evsel *evsel, struct perf_sample *sample) |
static int | perf_evsel__process_lock_acquire (struct perf_evsel *evsel, struct perf_sample *sample) |
static int | perf_evsel__process_lock_acquired (struct perf_evsel *evsel, struct perf_sample *sample) |
static int | perf_evsel__process_lock_contended (struct perf_evsel *evsel, struct perf_sample *sample) |
static int | perf_evsel__process_lock_release (struct perf_evsel *evsel, struct perf_sample *sample) |
static void | print_bad_events (int bad, int total) |
static void | print_result (void) |
static void | dump_threads (void) |
static void | dump_map (void) |
static int | dump_info (void) |
static int | process_sample_event (struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine) |
static void | sort_result (void) |
static int | __cmd_report (bool display_info) |
static int | __cmd_record (int argc, const char **argv) |
int | cmd_lock (int argc, const char **argv) |
Variables | |
static struct perf_session * | session |
static struct list_head | lockhash_table [LOCKHASH_SIZE] |
static struct rb_root | thread_stats |
static struct thread_stat *(* | thread_stat_findnew )(u32 tid) |
static const char * | sort_key = "acquired" |
static int(* | compare )(struct lock_stat *, struct lock_stat *) |
static struct rb_root | result |
struct lock_key | keys [] |
static int | bad_hist [BROKEN_MAX] |
static struct trace_lock_handler | report_lock_ops |
static struct trace_lock_handler * | trace_handler |
static bool | info_threads |
static bool | info_map |
static const struct perf_evsel_str_handler | lock_tracepoints [] |
static bool | force |
#define __lockhashfn | ( | key | ) | hash_long((unsigned long)key, LOCKHASH_BITS) |
Definition at line 42 of file builtin-lock.c.
Definition at line 250 of file builtin-lock.c.
#define LOCKHASH_BITS 12 |
Definition at line 37 of file builtin-lock.c.
#define LOCKHASH_SIZE (1UL << LOCKHASH_BITS) |
Definition at line 38 of file builtin-lock.c.
#define lockhashentry | ( | key | ) | (lockhash_table + __lockhashfn((key))) |
Definition at line 43 of file builtin-lock.c.
#define MAX_LOCK_DEPTH 48 |
Definition at line 94 of file builtin-lock.c.
#define SEQ_STATE_ACQUIRED 3 |
Definition at line 85 of file builtin-lock.c.
#define SEQ_STATE_ACQUIRING 2 |
Definition at line 84 of file builtin-lock.c.
#define SEQ_STATE_CONTENDED 5 |
Definition at line 87 of file builtin-lock.c.
#define SEQ_STATE_READ_ACQUIRED 4 |
Definition at line 86 of file builtin-lock.c.
#define SEQ_STATE_RELEASED 1 |
Definition at line 83 of file builtin-lock.c.
#define SEQ_STATE_UNINITIALIZED 0 /* initial state */ |
Definition at line 82 of file builtin-lock.c.
#define SINGLE_KEY | ( | member | ) |
Definition at line 209 of file builtin-lock.c.
typedef int(* tracepoint_handler) (struct perf_evsel *evsel, struct perf_sample *sample) |
Definition at line 809 of file builtin-lock.c.
enum acquire_flags |
Enumerator | |
---|---|
TRY_LOCK | |
READ_LOCK |
Definition at line 394 of file builtin-lock.c.
enum broken_state |
Enumerator | |
---|---|
BROKEN_ACQUIRE | |
BROKEN_ACQUIRED | |
BROKEN_CONTENDED | |
BROKEN_RELEASE | |
BROKEN_MAX |
Definition at line 384 of file builtin-lock.c.
|
static |
|
static |
int cmd_lock | ( | int | argc, |
const char ** | argv | ||
) |
|
static |
|
static |
Definition at line 780 of file builtin-lock.c.
|
static |
|
static |
|
static |
Definition at line 281 of file builtin-lock.c.
|
static |
Definition at line 222 of file builtin-lock.c.
|
static |
Definition at line 659 of file builtin-lock.c.
|
static |
Definition at line 667 of file builtin-lock.c.
|
static |
Definition at line 675 of file builtin-lock.c.
|
static |
Definition at line 683 of file builtin-lock.c.
|
static |
Definition at line 303 of file builtin-lock.c.
|
static |
Definition at line 691 of file builtin-lock.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 265 of file builtin-lock.c.
|
static |
|
static |
Definition at line 122 of file builtin-lock.c.
|
static |
|
static |
|
static |
Definition at line 141 of file builtin-lock.c.
|
static |
Definition at line 392 of file builtin-lock.c.
Definition at line 246 of file builtin-lock.c.
|
static |
Definition at line 857 of file builtin-lock.c.
|
static |
Definition at line 760 of file builtin-lock.c.
|
static |
Definition at line 760 of file builtin-lock.c.
struct lock_key keys[] |
Definition at line 252 of file builtin-lock.c.
|
static |
Definition at line 850 of file builtin-lock.c.
|
static |
Definition at line 40 of file builtin-lock.c.
|
static |
Definition at line 650 of file builtin-lock.c.
|
static |
Definition at line 248 of file builtin-lock.c.
|
static |
Definition at line 34 of file builtin-lock.c.
|
static |
Definition at line 244 of file builtin-lock.c.
|
static |
Definition at line 186 of file builtin-lock.c.
|
static |
Definition at line 120 of file builtin-lock.c.
|
static |
Definition at line 657 of file builtin-lock.c.