Skip to content

Commit

Permalink
Additional changes and edits based on external review
Browse files Browse the repository at this point in the history
  • Loading branch information
amd-jnovotny committed Jul 15, 2024
1 parent dd65339 commit 821d74a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 46 deletions.
2 changes: 1 addition & 1 deletion docs/conceptual/omnitrace-feature-set.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ broad picture.
.. note::

For insight into the execution of individual kernels on the GPU,
use `Omniperf <https://rocm.github.io/omniperf/index.html>`_.
use `Omniperf <https://github.com/rocm/omniperf>`_.

In terms of CPU analysis, Omnitrace does not target any specific vendor.
It works just as well on AMD and non-AMD CPUs.
Expand Down
47 changes: 34 additions & 13 deletions docs/how-to/using-omnitrace-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
Using the Omnitrace API
****************************************************

The following example shows how a program invokes the Omnitrace API to analyze a program.
The following example shows how a program can use the Omnitrace API to analyze a program.

Omnitrace user API example program
========================================

The Omnitrace API allows you to define custom regions to profile and trace.
The following C++ program demonstrates this technique by calling several functions from the
Omnitrace API, such as ``omnitrace_user_push_region`` and
``omnitrace_user_stop_thread_trace``.

.. note::

Expand All @@ -19,13 +27,6 @@ The following example shows how a program invokes the Omnitrace API to analyze a
recorded, regardless of whether ``omnitrace_user_start_*`` or
``omnitrace_user_stop_*`` has been called.

Omnitrace user API example program
========================================

The following C++ program demonstrates how to call several functions from the
Omnitrace API, such as ``omnitrace_user_push_region`` and
``omnitrace_user_stop_thread_trace``.

.. code-block:: shell
#include <omnitrace/categories.h>
Expand Down Expand Up @@ -154,16 +155,36 @@ Omnitrace API, such as ``omnitrace_user_push_region`` and
return (*original_callbacks.push_region)(name);
}
Linking the Omnitrace libraries to another program
=======================================================
To link the ``omnitrace-user-library`` to another program,
use the following CMake and ``g++`` directives.
CMake
-------------------------------------------------------
.. code-block:: cmake
find_package(omnitrace REQUIRED COMPONENTS user)
add_executable(foo foo.cpp)
target_link_libraries(foo PRIVATE omnitrace::omnitrace-user-library)
g++ compilation
-------------------------------------------------------
Assuming Omnitrace is installed in ``/opt/omnitrace``, use the ``g++`` compiler
to build the application.
.. code-block:: shell
g++ -I/opt/omnitrace foo.cpp -o foo -lomnitrace-user
Output from the API example program
========================================
First, instrument and run the program.
.. note::
For information on compiling and building Omnitrace,
see :doc:`Compiling Omnitrace with CMake <../reference/compiling-cmake>`.
.. code-block:: shell
$ omnitrace-instrument -l --min-instructions=8 -E custom_push_region -o -- ./user-api
Expand Down
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ The documentation is structured as follows:
* :doc:`API library <./doxygen/html/files>`
* :doc:`Functions <./doxygen/html/globals>`
* :doc:`Data structures <./doxygen/html/annotated>`
* :doc:`Compiling Omnitrace with CMake <./reference/compiling-cmake>`
* :doc:`Development guide <./reference/development-guide>`


Expand Down
28 changes: 0 additions & 28 deletions docs/reference/compiling-cmake.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/sphinx/_toc.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ subtrees:

- caption: Reference
entries:
- file: reference/compiling-cmake.rst
title: Compiling Omnitrace with CMake

- file: reference/development-guide.rst
title: Development guide

Expand Down

0 comments on commit 821d74a

Please sign in to comment.