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
Kirill Smelkov
linux
Commits
fd7826d5
Commit
fd7826d5
authored
Sep 26, 2008
by
Robert Richter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oprofile: implement switch/case in buffer_sync.c
Signed-off-by:
Robert Richter
<
robert.richter@amd.com
>
parent
fe615cbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
drivers/oprofile/buffer_sync.c
drivers/oprofile/buffer_sync.c
+14
-8
No files found.
drivers/oprofile/buffer_sync.c
View file @
fd7826d5
...
@@ -561,6 +561,7 @@ void sync_buffer(int cpu)
...
@@ -561,6 +561,7 @@ void sync_buffer(int cpu)
{
{
struct
oprofile_cpu_buffer
*
cpu_buf
=
&
per_cpu
(
cpu_buffer
,
cpu
);
struct
oprofile_cpu_buffer
*
cpu_buf
=
&
per_cpu
(
cpu_buffer
,
cpu
);
struct
mm_struct
*
mm
=
NULL
;
struct
mm_struct
*
mm
=
NULL
;
struct
mm_struct
*
oldmm
;
struct
task_struct
*
new
;
struct
task_struct
*
new
;
unsigned
long
cookie
=
0
;
unsigned
long
cookie
=
0
;
int
in_kernel
=
1
;
int
in_kernel
=
1
;
...
@@ -586,34 +587,39 @@ void sync_buffer(int cpu)
...
@@ -586,34 +587,39 @@ void sync_buffer(int cpu)
struct
op_sample
*
s
=
&
cpu_buf
->
buffer
[
cpu_buf
->
tail_pos
];
struct
op_sample
*
s
=
&
cpu_buf
->
buffer
[
cpu_buf
->
tail_pos
];
if
(
is_code
(
s
->
eip
))
{
if
(
is_code
(
s
->
eip
))
{
if
(
s
->
event
<=
CPU_IS_KERNEL
)
{
switch
(
s
->
event
)
{
case
0
:
case
CPU_IS_KERNEL
:
/* kernel/userspace switch */
/* kernel/userspace switch */
in_kernel
=
s
->
event
;
in_kernel
=
s
->
event
;
if
(
state
==
sb_buffer_start
)
if
(
state
==
sb_buffer_start
)
state
=
sb_sample_start
;
state
=
sb_sample_start
;
add_kernel_ctx_switch
(
s
->
event
);
add_kernel_ctx_switch
(
s
->
event
);
}
else
if
(
s
->
event
==
CPU_TRACE_BEGIN
)
{
break
;
case
CPU_TRACE_BEGIN
:
state
=
sb_bt_start
;
state
=
sb_bt_start
;
add_trace_begin
();
add_trace_begin
();
break
;
#ifdef CONFIG_OPROFILE_IBS
#ifdef CONFIG_OPROFILE_IBS
}
else
if
(
s
->
event
==
IBS_FETCH_BEGIN
)
{
case
IBS_FETCH_BEGIN
:
state
=
sb_bt_start
;
state
=
sb_bt_start
;
add_ibs_begin
(
cpu_buf
,
IBS_FETCH_CODE
,
mm
);
add_ibs_begin
(
cpu_buf
,
IBS_FETCH_CODE
,
mm
);
}
else
if
(
s
->
event
==
IBS_OP_BEGIN
)
{
break
;
case
IBS_OP_BEGIN
:
state
=
sb_bt_start
;
state
=
sb_bt_start
;
add_ibs_begin
(
cpu_buf
,
IBS_OP_CODE
,
mm
);
add_ibs_begin
(
cpu_buf
,
IBS_OP_CODE
,
mm
);
break
;
#endif
#endif
}
else
{
default:
struct
mm_struct
*
oldmm
=
mm
;
/* userspace context switch */
/* userspace context switch */
oldmm
=
mm
;
new
=
(
struct
task_struct
*
)
s
->
event
;
new
=
(
struct
task_struct
*
)
s
->
event
;
release_mm
(
oldmm
);
release_mm
(
oldmm
);
mm
=
take_tasks_mm
(
new
);
mm
=
take_tasks_mm
(
new
);
if
(
mm
!=
oldmm
)
if
(
mm
!=
oldmm
)
cookie
=
get_exec_dcookie
(
mm
);
cookie
=
get_exec_dcookie
(
mm
);
add_user_ctx_switch
(
new
,
cookie
);
add_user_ctx_switch
(
new
,
cookie
);
break
;
}
}
}
else
if
(
state
>=
sb_bt_start
&&
}
else
if
(
state
>=
sb_bt_start
&&
!
add_sample
(
mm
,
s
,
in_kernel
))
{
!
add_sample
(
mm
,
s
,
in_kernel
))
{
...
...
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