Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
builtin-lock.c File Reference
#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 "util/parse-options.h"
#include "util/trace-event.h"
#include "util/debug.h"
#include "util/session.h"
#include "util/tool.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>

Go to the source code of this file.

Data Structures

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

int cmd_lock (int argc, const char **argv, const char *prefix __maybe_unused)
 

Variables

struct lock_key keys []
 

Macro Definition Documentation

#define __lockhashfn (   key)    hash_long((unsigned long)key, LOCKHASH_BITS)

Definition at line 37 of file builtin-lock.c.

#define DEF_KEY_LOCK (   name,
  fn_suffix 
)    { #name, lock_stat_key_ ## fn_suffix }

Definition at line 242 of file builtin-lock.c.

#define LOCKHASH_BITS   12

Definition at line 32 of file builtin-lock.c.

#define LOCKHASH_SIZE   (1UL << LOCKHASH_BITS)

Definition at line 33 of file builtin-lock.c.

#define lockhashentry (   key)    (lockhash_table + __lockhashfn((key)))

Definition at line 38 of file builtin-lock.c.

#define MAX_LOCK_DEPTH   48

Definition at line 87 of file builtin-lock.c.

#define SEQ_STATE_ACQUIRED   3

Definition at line 78 of file builtin-lock.c.

#define SEQ_STATE_ACQUIRING   2

Definition at line 77 of file builtin-lock.c.

#define SEQ_STATE_CONTENDED   5

Definition at line 80 of file builtin-lock.c.

#define SEQ_STATE_READ_ACQUIRED   4

Definition at line 79 of file builtin-lock.c.

#define SEQ_STATE_RELEASED   1

Definition at line 76 of file builtin-lock.c.

#define SEQ_STATE_UNINITIALIZED   0 /* initial state */

Definition at line 75 of file builtin-lock.c.

#define SINGLE_KEY (   member)
Value:
static int lock_stat_key_ ## member(struct lock_stat *one, \
struct lock_stat *two) \
{ \
return one->member > two->member; \
}

Definition at line 202 of file builtin-lock.c.

Typedef Documentation

typedef int(* tracepoint_handler)(struct perf_evsel *evsel, struct perf_sample *sample)

Definition at line 801 of file builtin-lock.c.

Enumeration Type Documentation

Enumerator:
TRY_LOCK 
READ_LOCK 

Definition at line 385 of file builtin-lock.c.

Enumerator:
BROKEN_ACQUIRE 
BROKEN_ACQUIRED 
BROKEN_CONTENDED 
BROKEN_RELEASE 
BROKEN_MAX 

Definition at line 375 of file builtin-lock.c.

Function Documentation

int cmd_lock ( int  argc,
const char **  argv,
const char *prefix  __maybe_unused 
)

Definition at line 921 of file builtin-lock.c.

Variable Documentation

struct lock_key keys[]
Initial value:
= {
DEF_KEY_LOCK(acquired, nr_acquired),
DEF_KEY_LOCK(contended, nr_contended),
DEF_KEY_LOCK(wait_total, wait_time_total),
DEF_KEY_LOCK(wait_min, wait_time_min),
DEF_KEY_LOCK(wait_max, wait_time_max),
{ NULL, NULL }
}

Definition at line 244 of file builtin-lock.c.