- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A graph is usually associated with some nice graphical presentation.
Yet The VTune? for Linux (Command Line) has no
graphical utilities to show the call graph.
On first glance, that might seem like a definite
missing feature. But it might not be.
In this small article I?ll try to convince you that
text representation for call graph is powerful
enough to get quick and meaningful results.
Use scripts to collect data
The great news for The VTune? for Linux (Command Line)
is ? Command Line Interface. Actually that means one
can script everything. You may create different
activities that check different program paths in your
application. Run these activities, get the results and
save them in files. All these operations can be performed
in one simple script, which will run unattainable.
Look at this example.
TIP: Use excessive output. Vtl application has
numerous switches to give the user the exact information
he/she requires. E.g. it is possible to get the
information about one specific function.
But I recommend using the excessive approach,
i.e. to get all available info about all functions or
calls (use flags ?functions/-calls).
Dump this information to file and later on filter
for specific function(s).
Analyzing the results
Now use all your Linux favorite commands and applications
like ?tail?, ?awk?, ?perl? etc. to get the most of the
data dumped in file. The output files are tables, with
semi column used. The number of the column is printed in
it?s header. Here are some examples :
Comparing results
After doing some changes in your code, run the collection
a second time and dump result to files again. I attach a
small ?perl? script ?cmp? which compares 2 files with
function lists and prints out the functions with number
changes,
To use this script, supply 2 files and the column number, like:
Enjoy the text surfing of the cal l graph!
Yet The VTune? for Linux (Command Line) has no
graphical utilities to show the call graph.
On first glance, that might seem like a definite
missing feature. But it might not be.
In this small article I?ll try to convince you that
text representation for call graph is powerful
enough to get quick and meaningful results.
Use scripts to collect data
The great news for The VTune? for Linux (Command Line)
is ? Command Line Interface. Actually that means one
can script everything. You may create different
activities that check different program paths in your
application. Run these activities, get the results and
save them in files. All these operations can be performed
in one simple script, which will run unattainable.
Look at this example.
#!/bin/csh mkdir results set name=MyAppPath1 # create and run an activity ?MyAppPath1? that runs # /home/user/myapp ?path1 # in the /home/user/mywork directory vtl activity $name -c callgraph -app /home/user/myapp,-path1,/home/user/mywork ?moi /home/user/myapp run #print the list of all functions with collected data vtl view ?functions >! results/${name}_func.csv #list functions in the critical path vtl view -critical-path >! results/${name}_cp.csv #print out the list of each function and it?s callees vtl view -calls >! results/${name}_calls.csv #run your application with other flags(e.g. with ?path2) set name=MyAppPath2 vtl activity $name -c callgraph -app /home/user/myapp,-path2,/home/user/mywork ?moi /home/user/myapp run vtl view ?functions >! results/${name}_func.csv vtl view -critical-path >! results/${name}_cp.csv vtl view -calls >! results/${name}_calls.csv #etc
TIP: Use excessive output. Vtl application has
numerous switches to give the user the exact information
he/she requires. E.g. it is possible to get the
information about one specific function.
But I recommend using the excessive approach,
i.e. to get all available info about all functions or
calls (use flags ?functions/-calls).
Dump this information to file and later on filter
for specific function(s).
Analyzing the results
Now use all your Linux favorite commands and applications
like ?tail?, ?awk?, ?perl? etc. to get the most of the
data dumped in file. The output files are tables, with
semi column used. The number of the column is printed in
it?s header. Here are some examples :
# get top 10 functions with biggest ?Total Time?, which is the 6-th column sort -k 6 -n -t; -r MyAppPath1_func.csv | head -10 | less ?S # top 10 functions with biggest ?Self Time?, which is the 5-th column in library #?libc? grep libc MyAppPath1_func.csv | sort -k 6 -n -t; -r | head -10 | less ?S #print only 2 columns: function name and number of calls awk -F; '{print $1 $9}' MyAppPath1_func.csv
Comparing results
After doing some changes in your code, run the collection
a second time and dump result to files again. I attach a
small ?perl? script ?cmp? which compares 2 files with
function lists and prints out the functions with number
changes,
To use this script, supply 2 files and the column number, like:
cmp ftabl1(reference) ftabl2 col_num
Enjoy the text surfing of the cal l graph!
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to view the top "10" functions like you suggested. Howerver this is the "sampling" mode. Here is what I am trying to do. However -functions doesn't display anything. Am I missing something ?
Thanks
Vadi
zeppelin[/tpcc/benchmarks/TC24]vtl show
VTune Performance Analyzer 1.0 for Linux*
Copyright (C) 2000-2003 Intel Corporation. All rights reserved.
....
a3__tpcc_cg
r1_____Sampling Results [zeppelin] - Tue Mar 4 11:40:13 2003
a4__tpcc_cg zeppelin[/tpcc/benchmarks/TC24]vtl view a3::r1 -functions
VTune Performance Analyzer 1.0 for Linux*
Copyright (C) 2000-2003 Intel Corporation. All rights reserved.
Event Summary
Instructions Retired
245127 = Samples collected due to this event
700000 = Sample after value used during collection
171588900000 = Total events (samples*SAV)
Clockticks
1305165 = Samples collected due to this event
700000 = Sample after value used during collection
913615500000 = Total events (samples*SAV)
I am trying to view the top "10" functions like you suggested. Howerver this is the "sampling" mode. Here is what I am trying to do. However -functions doesn't display anything. Am I missing something ?
Thanks
Vadi
zeppelin[/tpcc/benchmarks/TC24]vtl show
VTune Performance Analyzer 1.0 for Linux*
Copyright (C) 2000-2003 Intel Corporation. All rights reserved.
....
a3__tpcc_cg
r1_____Sampling Results [zeppelin] - Tue Mar 4 11:40:13 2003
a4__tpcc_cg zeppelin[/tpcc/benchmarks/TC24]vtl view a3::r1 -functions
VTune Performance Analyzer 1.0 for Linux*
Copyright (C) 2000-2003 Intel Corporation. All rights reserved.
Event Summary
Instructions Retired
245127 = Samples collected due to this event
700000 = Sample after value used during collection
171588900000 = Total events (samples*SAV)
Clockticks
1305165 = Samples collected due to this event
700000 = Sample after value used during collection
913615500000 = Total events (samples*SAV)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
indeed the format of output files is different between sampling and callgraph results.
moreover, it might be different when different flags are applied.
in my article I tried to give examples of parsing the output files with grep, awk, sort etc.
the use depends of course on the formatting of the file itself. like separators (in call graph ;, in sampling ?)
my advice is to dump the whole file (with vtl view [flags] > so,e_file) and study the context of the file formatting, then use grep/awk/sort accordingly
you can also try to use some spreadsheet application awaiable (like kspread or Sun Office etc)
indeed the format of output files is different between sampling and callgraph results.
moreover, it might be different when different flags are applied.
in my article I tried to give examples of parsing the output files with grep, awk, sort etc.
the use depends of course on the formatting of the file itself. like separators (in call graph ;, in sampling
my advice is to dump the whole file (with vtl view [flags] > so,e_file) and study the context of the file formatting, then use grep/awk/sort accordingly
you can also try to use some spreadsheet application awaiable (like kspread or Sun Office etc)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
attaching "cmp" script, promised in the original article.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page