Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
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
mariadb
Commits
40a9184e
Commit
40a9184e
authored
May 07, 2010
by
Dave Wells
Committed by
Yoni Fogel
Apr 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add thread parsing
git-svn-id:
file:///svn/toku/tokudb@19929
c7de825b-a66e-492c-adef-691d508d4ae1
parent
ee819135
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
23 deletions
+47
-23
utils/parseTraceFiles.py
utils/parseTraceFiles.py
+47
-23
No files found.
utils/parseTraceFiles.py
View file @
40a9184e
...
...
@@ -10,12 +10,13 @@ except:
ts_factor
=
1.
ts_prev
=
0.
xxx
=
[]
threadlist
=
[]
for
line
in
data
:
line
=
line
.
rstrip
(
"
\
n
"
)
vals
=
line
.
split
()
[
n
,
tid
,
ts
,
funcline
]
=
vals
[
0
:
4
]
# 'note' is all text following funcline
note
=
''
for
v
in
vals
[
4
:
-
1
]:
note
+=
v
+
' '
...
...
@@ -27,32 +28,55 @@ for line in data:
time
=
(
float
(
ts
)
-
ts_prev
)
/
ts_factor
found_it
=
0
for
x
in
xxx
:
if
note
==
x
[
0
]:
found_it
=
1
x
[
1
]
+=
time
# create a list of threads
# - each thread has a list of <note,time> pairs, where time is the accumulated time for that note
# - search threadlist for thread_id (tid)
# - if found, search corresponding list of <note,time> pairs for the current note
# - if found, update (+=) the time
# - if not found, create a new <note,time> pair
# - if not found, create a new thread,<note,time> entry
found_thread
=
0
for
thread
in
threadlist
:
if
tid
==
thread
[
0
]:
found_thread
=
1
notetimelist
=
thread
[
1
]
found_note
=
0
for
notetime
in
notetimelist
:
if
note
==
notetime
[
0
]:
found_note
=
1
notetime
[
1
]
+=
time
break
if
found_note
==
0
:
thread
[
1
].
append
([
note
,
time
])
break
if
found_it
==
0
:
xxx
.
append
([
note
,
time
])
if
found_thread
==
0
:
notetime
=
[]
notetime
.
append
([
note
,
time
])
threadlist
.
append
([
tid
,
notetime
])
ts_prev
=
float
(
ts
)
# trim out unneeded
yyy
=
[]
for
x
in
xxx
:
if
x
[
0
][
0
:
9
]
==
'calibrate'
:
yyy
.
append
(
x
)
for
y
in
yyy
:
xxx
.
remove
(
y
)
print
''
total_time
=
0
;
for
x
in
xxx
:
total_time
+=
x
[
1
]
for
x
in
xxx
:
print
"%20s %5d"
%
(
x
[
0
],
100.
*
x
[
1
]
/
total_time
)
for
thread
in
threadlist
:
trimlist
=
[]
for
notetime
in
thread
[
1
]:
if
notetime
[
0
][
0
:
9
]
==
'calibrate'
:
trimlist
.
append
(
notetime
)
for
notetime
in
trimlist
:
thread
[
1
].
remove
(
notetime
)
print
''
# sum times to calculate percent (of 100)
total_time
=
0
for
thread
in
threadlist
:
for
[
note
,
time
]
in
thread
[
1
]:
total_time
+=
time
print
' thread operation time(sec) percent'
for
thread
in
threadlist
:
print
'tid : %5s'
%
thread
[
0
]
for
[
note
,
time
]
in
thread
[
1
]:
print
' %20s %f %5d'
%
(
note
,
time
,
100.
*
time
/
total_time
)
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