Jump to content

OProfile: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
mNo edit summary
Adding short description: "Statistical profiling tool for Linux" (Shortdesc helper)
 
(30 intermediate revisions by 27 users not shown)
Line 1: Line 1:
{{Short description|Statistical profiling tool for Linux}}
{{Infobox software
{{Infobox software
| name = OProfile
| name = OProfile
| title =
| title =
| logo = <!-- [[File: ]] -->
| logo = <!-- [[File:]] -->
| logo caption =
| logo caption =
| screenshot = <!-- [[File: ]] -->
| screenshot = <!-- [[File:]] -->
| caption =
| caption =
| collapsible =
| collapsible =
| author = John Levon
| author = John Levon
| developer =
| developer =
| released = 2001
| released = 2001
| discontinued =
| discontinued =
| latest release version =
| latest release version = 1.4.0
| latest release date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} -->
| latest release date = {{Start date and age|2020|07|20}}
| latest preview version =
| latest preview version =
| latest preview date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} -->
| latest preview date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} -->
| frequently updated = <!-- DO NOT include this parameter unless you know what it does -->
| programming language = C
| programming language = C
| operating system = Linux
| operating system = [[Linux]]
| platform = cross-platform
| platform = [[Cross-platform]]
| size =
| size =
| language =
| language =
| status =
| genre = [[Profiling (computer programming)|Profiler]]
| genre = profiler
| license = [[GPL]]
| license = GPL
| website = {{url|http://oprofile.sourceforge.net/news/}}
| website = http://oprofile.sourceforge.net/news/
}}
}}
'''OProfile''' is a system-wide [[statistical]] [[Profiling (computer programming)|profiling tool]] for [[Linux]]. Written by John Levon in 2001 for [[Linux kernel]] version 2.4 after his M.Sc. project.<ref>[http://kerneltrap.org/node/4 Interview: John Levon], 11 Nov 2001 // KernelTrap: "John Levon, the author of OProfile"</ref> Consists of [[Kernel (computing)|kernel]] module, [[user-space]] [[daemon (Unix)|daemon]] and several user-space tools.
In [[computing]], '''OProfile''' is a system-wide [[statistical]] [[profiling (computer programming)|profiling tool]] for [[Linux]]. John Levon wrote it in 2001 for [[Linux kernel]] version 2.4 after his [[M.Sc.]] project;<ref>[http://kerneltrap.org/node/4 Interview: John Levon] {{Webarchive|url=https://web.archive.org/web/20120513071735/http://kerneltrap.org/node/4 |date=2012-05-13 }}, 11 Nov 2001 // KernelTrap: "John Levon, the author of OProfile"</ref> it consists of a [[kernel (operating system)|kernel]] module, a [[user-space]] [[daemon (Unix)|daemon]] and several user-space tools.


==Details==
This tool is capable of profiling an entire system or its parts, from [[interrupt routines]] or [[Device driver|drivers]], to user-space [[Process (computing)|processes]]. It has low overhead.
OProfile can profile an entire system or its parts, from [[interrupt routines]] or [[device driver|drivers]], to user-space [[process (computing)|processes]]. It has low overhead.


Most portable mode of oprofile uses system timer to generate sampling interrupts (events). Less portable mode allows [[hardware performance counter]]s to be used for sampling events generationed on several processor architectures. In Linux 2.2/2.4 only 32-bit [[x86]] and [[IA64]] are supported; in Linux 2.6 there is wider support: x86 (32 and 64 bit), [[DEC Alpha]], [[MIPS architecture|MIPS]], [[ARM architecture|ARM]], [[sparc64]], [[ppc64]], [[AVR32]].
The most widely supported kernel mode of {{mono|oprofile}} uses a system timer (See: [[profiling (computer programming)#Gathering program events|Gathering profiling events]]). However, this mode is unable to measure kernel functions where [[interrupts]] are disabled. Newer CPU models support a [[hardware performance counter]] mode which uses hardware logic to record events without any active code needed. In Linux 2.2/2.4 only 32-bit [[x86]] and [[IA64]] are supported; in Linux 2.6 there is wider support: x86 (32 and 64 bit), [[DEC Alpha]], [[MIPS architecture|MIPS]], [[ARM architecture|ARM]], [[SPARC|sparc64]], [[ppc64]], [[AVR32]].


[[Call graph]]s are supported only on x86 and ARM.
[[Call graph]]s are supported only on x86 and ARM.


In 2012 it was recognized by IBM's engineers as one of two most commonly used [[Hardware performance counter|performance counter monitor]] profiling tools on Linux; the other was [[perf (Linux)|perf tool]].<ref>A. Zanella, R. Arnold. [http://www.ibm.com/developerworks/linux/library/l-evaluatelinuxonpower/ Evaluate performance for Linux on POWER. Analyze performance using Linux tools], 12 Jun 2012 // IBM DeveloperWorks Technical library</ref>
In 2012 two IBM engineers recognized OProfile as one of the two most commonly used [[Hardware performance counter|performance counter monitor]] profiling tools on Linux, alongside [[perf (Linux)|perf tool]].<ref>
{{cite web
| url = http://www.ibm.com/developerworks/linux/library/l-evaluatelinuxonpower/
| title = Evaluate performance for Linux on POWER: Analyze performance using Linux tools
| last1 = Netto
| first1 = Adhemerval Zanella
| last2 = Arnold
| first2 = Ryan S.
| date = 2012-06-12
| website = developerWorks
| series = IBM DeveloperWorks Technical library
| publisher = IBM
| accessdate = 2014-10-21
| quote = The two most commonly-used tools for PCM profiling on Linux are {{mono|OProfile}} and {{mono|perf}} [...].
}}
</ref>


In 2021, OProfile is set to be removed from version 5.12 of the Linux kernel, with the user-space tools continuing to work by using the kernel's perf system.<ref>{{Cite web|url=https://www.phoronix.com/scan.php?page=news_item&px=OProfile-Linux-5.12-Removal|title = OProfile Kernel Code Slated for Removal in Linux 5.12 - Phoronix}}</ref>
== User-space tools ==

* ''opcontrol'' is used to start and stop the daemon, which collects profiling data. This data is periodically saved to the <tt>/var/lib/oprofile/samples</tt> directory.
=== User-space tools ===
* ''opreport'' shows basic profiling data. 'opannotate' can produce annotated [[Source code|source]]s or [[Assembly language|assembly]].
* {{mono|opcontrol}} is used to start and stop the daemon, which collects profiling data. This data is periodically saved to the {{mono|/var/lib/oprofile/samples}} directory.
* ''opgprof'' converts from oprofile data into [[gprof]]-compatible format.<ref>http://oprofile.sourceforge.net/doc/tools-overview.html</ref>
* {{mono|opreport}} shows basic profiling data. {{mono|opannotate}} can produce annotated [[Source code|sources]] or [[Assembly language|assembly]].
* {{mono|opgprof}} converts from oprofile data into [[gprof]]-compatible format.<ref>{{Cite web|url=https://oprofile.sourceforge.io/doc/tools-overview.html|title=4. Tools summary|website=oprofile.sourceforge.io}}</ref>


Example:
Example:
{{sxhl|lang=console|
$ opcontrol --start # If there are any issues in starting like --vm-linux just follow the instructions


$ ./${example_file}
opcontrol—start ( If there are any issues in starting like—vm-linux just follow the instructions)


$ opcontrol --dump
run <example>


$ opreport -l ${example_file} > ${output_file}
opcontrol—dump


$ opcontrol --stop # stops collecting the data
opreport -l <example> > <outputfile>


$ opcontrol --shutdown # stops the demon
opcontrol—stop (stops collecting the data)


$ opcontrol --reset # clears the profile data which was stored in the sample file given
opcontrol—shutdown (Stops the demon)
}}


==See also==
opcontrol -reset (clears the profile data which was stored in the sample file given)

== See also==
* [[List of performance analysis tools]]
* [[List of performance analysis tools]]


== References ==
== References ==
{{Reflist}}
<references/>


==External links==
==External links==
* http://oprofile.sourceforge.net/news/
* {{Official website|http://oprofile.sourceforge.net/news/}}
* W. Cohen, [http://people.redhat.com/wcohen/Oprofile.pdf Tuning programs with OProfile] // Wide Open Magazine, 2004, pages 53–62
* W. Cohen, [http://people.redhat.com/wcohen/Oprofile.pdf Tuning programs with OProfile] // Wide Open Magazine, 2004, pages 53–62
* Prasanna Panchamukhi, [http://www.ibm.com/developerworks/linux/library/l-oprof/index.html Smashing performance with OProfile. Identifying performance bottlenecks in real-world systems] // IBM DeveloperWorks, Technical Library, 16 Oct 2003
* Prasanna Panchamukhi, [http://www.ibm.com/developerworks/linux/library/l-oprof/index.html Smashing performance with OProfile. Identifying performance bottlenecks in real-world systems] // IBM DeveloperWorks, Technical Library, 16 Oct 2003
* Justin Thiel, [http://www.cse.wustl.edu/~jain/cse567-06/ftp/sw_monitors1/index.html#sec2.2.2 An Overview of Software Performance Analysis Tools and Techniques: From GProf to DTrace], (2006) "2.2.2 Overview of Oprofile"
* Justin Thiel, [http://www.cse.wustl.edu/~jain/cse567-06/ftp/sw_monitors1/index.html#sec2.2.2 An Overview of Software Performance Analysis Tools and Techniques: From GProf to DTrace], (2006) "2.2.2 Overview of Oprofile"


[[Category:Linux kernel features]]
[[Category:Profilers]]
[[Category:Profilers]]
[[Category:Linux kernel features]]


{{linux-stub}}

[[fr:OProfile]]

Latest revision as of 18:52, 21 November 2021

Original author(s)John Levon
Initial release2001
Stable release
1.4.0 / July 20, 2020; 4 years ago (2020-07-20)
Written inC
Operating systemLinux
PlatformCross-platform
TypeProfiler
LicenseGPL
Websiteoprofile.sourceforge.net/news/

In computing, OProfile is a system-wide statistical profiling tool for Linux. John Levon wrote it in 2001 for Linux kernel version 2.4 after his M.Sc. project;[1] it consists of a kernel module, a user-space daemon and several user-space tools.

Details

[edit]

OProfile can profile an entire system or its parts, from interrupt routines or drivers, to user-space processes. It has low overhead.

The most widely supported kernel mode of oprofile uses a system timer (See: Gathering profiling events). However, this mode is unable to measure kernel functions where interrupts are disabled. Newer CPU models support a hardware performance counter mode which uses hardware logic to record events without any active code needed. In Linux 2.2/2.4 only 32-bit x86 and IA64 are supported; in Linux 2.6 there is wider support: x86 (32 and 64 bit), DEC Alpha, MIPS, ARM, sparc64, ppc64, AVR32.

Call graphs are supported only on x86 and ARM.

In 2012 two IBM engineers recognized OProfile as one of the two most commonly used performance counter monitor profiling tools on Linux, alongside perf tool.[2]

In 2021, OProfile is set to be removed from version 5.12 of the Linux kernel, with the user-space tools continuing to work by using the kernel's perf system.[3]

User-space tools

[edit]
  • opcontrol is used to start and stop the daemon, which collects profiling data. This data is periodically saved to the /var/lib/oprofile/samples directory.
  • opreport shows basic profiling data. opannotate can produce annotated sources or assembly.
  • opgprof converts from oprofile data into gprof-compatible format.[4]

Example:

$ opcontrol --start # If there are any issues in starting like --vm-linux just follow the instructions

$ ./${example_file}

$ opcontrol --dump

$ opreport -l ${example_file} > ${output_file}

$ opcontrol --stop # stops collecting the data

$ opcontrol --shutdown # stops the demon

$ opcontrol --reset # clears the profile data which was stored in the sample file given

See also

[edit]

References

[edit]
  1. ^ Interview: John Levon Archived 2012-05-13 at the Wayback Machine, 11 Nov 2001 // KernelTrap: "John Levon, the author of OProfile"
  2. ^ Netto, Adhemerval Zanella; Arnold, Ryan S. (2012-06-12). "Evaluate performance for Linux on POWER: Analyze performance using Linux tools". developerWorks. IBM DeveloperWorks Technical library. IBM. Retrieved 2014-10-21. The two most commonly-used tools for PCM profiling on Linux are OProfile and perf [...].
  3. ^ "OProfile Kernel Code Slated for Removal in Linux 5.12 - Phoronix".
  4. ^ "4. Tools summary". oprofile.sourceforge.io.
[edit]