-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lai Jiangshan
authored and
Ingo Molnar
committed
Mar 6, 2009
1 parent
7d33cfe
commit 71f31d1
Showing
8 changed files
with
241 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 546e5354a6e4ec760ac03ef1148e9a4762abb5f5 | ||
refs/heads/master: 1427cdf0592368bdec57276edaf714040ee8744f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* trace binary printk | ||
* | ||
* Copyright (C) 2008 Lai Jiangshan <laijs@cn.fujitsu.com> | ||
* | ||
*/ | ||
#include <linux/kernel.h> | ||
#include <linux/ftrace.h> | ||
#include <linux/string.h> | ||
#include <linux/ctype.h> | ||
#include <linux/list.h> | ||
#include <linux/mutex.h> | ||
#include <linux/slab.h> | ||
#include <linux/module.h> | ||
#include <linux/seq_file.h> | ||
#include <linux/fs.h> | ||
#include <linux/marker.h> | ||
#include <linux/uaccess.h> | ||
|
||
#include "trace.h" | ||
|
||
/* binary printk basic */ | ||
static DEFINE_MUTEX(btrace_mutex); | ||
static int btrace_metadata_count; | ||
|
||
static inline void lock_btrace(void) | ||
{ | ||
mutex_lock(&btrace_mutex); | ||
} | ||
|
||
static inline void unlock_btrace(void) | ||
{ | ||
mutex_unlock(&btrace_mutex); | ||
} | ||
|
||
static void get_btrace_metadata(void) | ||
{ | ||
lock_btrace(); | ||
btrace_metadata_count++; | ||
unlock_btrace(); | ||
} | ||
|
||
static void put_btrace_metadata(void) | ||
{ | ||
lock_btrace(); | ||
btrace_metadata_count--; | ||
unlock_btrace(); | ||
} | ||
|
||
/* events tracer */ | ||
int trace_bprintk_enable; | ||
|
||
static void start_bprintk_trace(struct trace_array *tr) | ||
{ | ||
get_btrace_metadata(); | ||
tracing_reset_online_cpus(tr); | ||
trace_bprintk_enable = 1; | ||
} | ||
|
||
static void stop_bprintk_trace(struct trace_array *tr) | ||
{ | ||
trace_bprintk_enable = 0; | ||
tracing_reset_online_cpus(tr); | ||
put_btrace_metadata(); | ||
} | ||
|
||
static int init_bprintk_trace(struct trace_array *tr) | ||
{ | ||
start_bprintk_trace(tr); | ||
return 0; | ||
} | ||
|
||
static struct tracer bprintk_trace __read_mostly = | ||
{ | ||
.name = "events", | ||
.init = init_bprintk_trace, | ||
.reset = stop_bprintk_trace, | ||
.start = start_bprintk_trace, | ||
.stop = stop_bprintk_trace, | ||
}; | ||
|
||
static __init int init_bprintk(void) | ||
{ | ||
return register_tracer(&bprintk_trace); | ||
} | ||
|
||
device_initcall(init_bprintk); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters