Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c4e2b432
Commit
c4e2b432
authored
Feb 17, 2009
by
Ingo Molnar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branches 'tracing/hw-branch-tracing' and 'tracing/power-tracer' into tracing/core
parents
a234aa9e
72b623c7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
119 additions
and
84 deletions
+119
-84
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+2
-0
arch/x86/kernel/process.c
arch/x86/kernel/process.c
+3
-0
include/trace/power.h
include/trace/power.h
+12
-13
kernel/trace/trace_power.c
kernel/trace/trace_power.c
+102
-71
No files found.
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
View file @
c4e2b432
...
...
@@ -70,6 +70,8 @@ struct acpi_cpufreq_data {
static
DEFINE_PER_CPU
(
struct
acpi_cpufreq_data
*
,
drv_data
);
DEFINE_TRACE
(
power_mark
);
/* acpi_perf_data is a pointer to percpu data. */
static
struct
acpi_processor_performance
*
acpi_perf_data
;
...
...
arch/x86/kernel/process.c
View file @
c4e2b432
...
...
@@ -19,6 +19,9 @@ EXPORT_SYMBOL(idle_nomwait);
struct
kmem_cache
*
task_xstate_cachep
;
DEFINE_TRACE
(
power_start
);
DEFINE_TRACE
(
power_end
);
int
arch_dup_task_struct
(
struct
task_struct
*
dst
,
struct
task_struct
*
src
)
{
*
dst
=
*
src
;
...
...
include/trace/power.h
View file @
c4e2b432
...
...
@@ -2,6 +2,7 @@
#define _TRACE_POWER_H
#include <linux/ktime.h>
#include <linux/tracepoint.h>
enum
{
POWER_NONE
=
0
,
...
...
@@ -18,18 +19,16 @@ struct power_trace {
#endif
};
#ifdef CONFIG_POWER_TRACER
extern
void
trace_power_start
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
state
);
extern
void
trace_power_mark
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
state
);
extern
void
trace_power_end
(
struct
power_trace
*
it
);
#else
static
inline
void
trace_power_start
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
state
)
{
}
static
inline
void
trace_power_mark
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
state
)
{
}
static
inline
void
trace_power_end
(
struct
power_trace
*
it
)
{
}
#endif
DECLARE_TRACE
(
power_start
,
TPPROTO
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
state
),
TPARGS
(
it
,
type
,
state
));
DECLARE_TRACE
(
power_mark
,
TPPROTO
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
state
),
TPARGS
(
it
,
type
,
state
));
DECLARE_TRACE
(
power_end
,
TPPROTO
(
struct
power_trace
*
it
),
TPARGS
(
it
));
#endif
/* _TRACE_POWER_H */
kernel/trace/trace_power.c
View file @
c4e2b432
...
...
@@ -21,15 +21,116 @@
static
struct
trace_array
*
power_trace
;
static
int
__read_mostly
trace_power_enabled
;
static
void
probe_power_start
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
level
)
{
if
(
!
trace_power_enabled
)
return
;
memset
(
it
,
0
,
sizeof
(
struct
power_trace
));
it
->
state
=
level
;
it
->
type
=
type
;
it
->
stamp
=
ktime_get
();
}
static
void
probe_power_end
(
struct
power_trace
*
it
)
{
struct
ring_buffer_event
*
event
;
struct
trace_power
*
entry
;
struct
trace_array_cpu
*
data
;
struct
trace_array
*
tr
=
power_trace
;
if
(
!
trace_power_enabled
)
return
;
preempt_disable
();
it
->
end
=
ktime_get
();
data
=
tr
->
data
[
smp_processor_id
()];
event
=
trace_buffer_lock_reserve
(
tr
,
TRACE_POWER
,
sizeof
(
*
entry
),
0
,
0
);
if
(
!
event
)
goto
out
;
entry
=
ring_buffer_event_data
(
event
);
entry
->
state_data
=
*
it
;
trace_buffer_unlock_commit
(
tr
,
event
,
0
,
0
);
out:
preempt_enable
();
}
static
void
probe_power_mark
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
level
)
{
struct
ring_buffer_event
*
event
;
struct
trace_power
*
entry
;
struct
trace_array_cpu
*
data
;
struct
trace_array
*
tr
=
power_trace
;
if
(
!
trace_power_enabled
)
return
;
memset
(
it
,
0
,
sizeof
(
struct
power_trace
));
it
->
state
=
level
;
it
->
type
=
type
;
it
->
stamp
=
ktime_get
();
preempt_disable
();
it
->
end
=
it
->
stamp
;
data
=
tr
->
data
[
smp_processor_id
()];
event
=
trace_buffer_lock_reserve
(
tr
,
TRACE_POWER
,
sizeof
(
*
entry
),
0
,
0
);
if
(
!
event
)
goto
out
;
entry
=
ring_buffer_event_data
(
event
);
entry
->
state_data
=
*
it
;
trace_buffer_unlock_commit
(
tr
,
event
,
0
,
0
);
out:
preempt_enable
();
}
static
int
tracing_power_register
(
void
)
{
int
ret
;
ret
=
register_trace_power_start
(
probe_power_start
);
if
(
ret
)
{
pr_info
(
"power trace: Couldn't activate tracepoint"
" probe to trace_power_start
\n
"
);
return
ret
;
}
ret
=
register_trace_power_end
(
probe_power_end
);
if
(
ret
)
{
pr_info
(
"power trace: Couldn't activate tracepoint"
" probe to trace_power_end
\n
"
);
goto
fail_start
;
}
ret
=
register_trace_power_mark
(
probe_power_mark
);
if
(
ret
)
{
pr_info
(
"power trace: Couldn't activate tracepoint"
" probe to trace_power_mark
\n
"
);
goto
fail_end
;
}
return
ret
;
fail_end:
unregister_trace_power_end
(
probe_power_end
);
fail_start:
unregister_trace_power_start
(
probe_power_start
);
return
ret
;
}
static
void
start_power_trace
(
struct
trace_array
*
tr
)
{
trace_power_enabled
=
1
;
tracing_power_register
();
}
static
void
stop_power_trace
(
struct
trace_array
*
tr
)
{
trace_power_enabled
=
0
;
unregister_trace_power_start
(
probe_power_start
);
unregister_trace_power_end
(
probe_power_end
);
unregister_trace_power_mark
(
probe_power_mark
);
}
...
...
@@ -39,6 +140,7 @@ static int power_trace_init(struct trace_array *tr)
power_trace
=
tr
;
trace_power_enabled
=
1
;
tracing_power_register
();
for_each_cpu
(
cpu
,
cpu_possible_mask
)
tracing_reset
(
tr
,
cpu
);
...
...
@@ -95,74 +197,3 @@ static int init_power_trace(void)
return
register_tracer
(
&
power_tracer
);
}
device_initcall
(
init_power_trace
);
void
trace_power_start
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
level
)
{
if
(
!
trace_power_enabled
)
return
;
memset
(
it
,
0
,
sizeof
(
struct
power_trace
));
it
->
state
=
level
;
it
->
type
=
type
;
it
->
stamp
=
ktime_get
();
}
EXPORT_SYMBOL_GPL
(
trace_power_start
);
void
trace_power_end
(
struct
power_trace
*
it
)
{
struct
ring_buffer_event
*
event
;
struct
trace_power
*
entry
;
struct
trace_array_cpu
*
data
;
struct
trace_array
*
tr
=
power_trace
;
if
(
!
trace_power_enabled
)
return
;
preempt_disable
();
it
->
end
=
ktime_get
();
data
=
tr
->
data
[
smp_processor_id
()];
event
=
trace_buffer_lock_reserve
(
tr
,
TRACE_POWER
,
sizeof
(
*
entry
),
0
,
0
);
if
(
!
event
)
goto
out
;
entry
=
ring_buffer_event_data
(
event
);
entry
->
state_data
=
*
it
;
trace_buffer_unlock_commit
(
tr
,
event
,
0
,
0
);
out:
preempt_enable
();
}
EXPORT_SYMBOL_GPL
(
trace_power_end
);
void
trace_power_mark
(
struct
power_trace
*
it
,
unsigned
int
type
,
unsigned
int
level
)
{
struct
ring_buffer_event
*
event
;
struct
trace_power
*
entry
;
struct
trace_array_cpu
*
data
;
struct
trace_array
*
tr
=
power_trace
;
if
(
!
trace_power_enabled
)
return
;
memset
(
it
,
0
,
sizeof
(
struct
power_trace
));
it
->
state
=
level
;
it
->
type
=
type
;
it
->
stamp
=
ktime_get
();
preempt_disable
();
it
->
end
=
it
->
stamp
;
data
=
tr
->
data
[
smp_processor_id
()];
event
=
trace_buffer_lock_reserve
(
tr
,
TRACE_POWER
,
sizeof
(
*
entry
),
0
,
0
);
if
(
!
event
)
goto
out
;
entry
=
ring_buffer_event_data
(
event
);
entry
->
state_data
=
*
it
;
trace_buffer_unlock_commit
(
tr
,
event
,
0
,
0
);
out:
preempt_enable
();
}
EXPORT_SYMBOL_GPL
(
trace_power_mark
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment