Fix release docs workflow + update documentation (#216)

* Fix release-docs workflow

* Documentation updates

- warning as errors when building docs
- fixed warnings when building docs
- fixed doxygen comments

* Miscellaneous fixes

* Fix doxygen comments

[ROCm/rocprofiler-systems commit: 7ecc037d17]
Cette révision appartient à :
Jonathan R. Madsen
2022-12-14 07:59:53 -06:00
révisé par GitHub
Parent 35f639a2b5
révision 75e1e8bf37
9 fichiers modifiés avec 146 ajouts et 122 suppressions
+17 -9
Voir le fichier
@@ -35,7 +35,7 @@ jobs:
generate_release_notes: True
release-docs:
if: github.repository == 'AMDResearch/omnitrace' && startsWith(github.ref, 'refs/tags/')
if: github.repository == 'AMDResearch/omnitrace' && (startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'releases/'))
runs-on: ubuntu-20.04
permissions:
contents: write
@@ -43,25 +43,33 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: gh-pages
- name: Update Source
run: |
git config --global user.name 'Jonathan R. Madsen'
git config --global user.email 'jrmadsen@users.noreply.github.com'
git config --global pull.rebase true
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git fetch origin
git checkout gh-pages
git pull origin main
- name: Install Conda
uses: s-weigand/setup-conda@v1
- name: Update Docs
working-directory: source/docs
run: |
conda env create -n omnitrace-docs -f environment.yml
source activate
conda activate omnitrace-docs
git config --global user.name 'Jonathan R. Madsen'
git config --global user.email 'jrmadsen@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git pull --rebase=true origin ${{ github.ref }}
./update-docs.sh
git add ../../docs
- name: Push changes
if: github.repository == 'AMDResearch/omnitrace' && startsWith(github.ref, 'refs/tags/')
run: |
git add docs
git commit -m "Update HTML (automated)"
git push -f
ubuntu:
installers:
if: github.repository == 'AMDResearch/omnitrace'
runs-on: ubuntu-20.04
strategy:
fail-fast: false
+5 -3
Voir le fichier
@@ -131,10 +131,12 @@ breathe_projects = {"omnitrace": "_doxygen/xml"}
breathe_default_project = "omnitrace"
breathe_default_members = ("members",)
breathe_projects_source = {
"auto": (
os.path.join(project_root, "source"),
"omnitrace": (
os.path.join(project_root, "source", "lib", "omnitrace-user"),
[
"lib/omnitrace-user/omnitrace/user.h",
"omnitrace/types.h",
"omnitrace/categories.h",
"omnitrace/user.h",
],
)
}
+10 -5
Voir le fichier
@@ -40,6 +40,8 @@ EXTENSION_MAPPING = hpp=C++ \
cpp=C++ \
hh=C++ \
cc=C++ \
h=C \
c=C \
py=Python
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 2
@@ -105,14 +107,16 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = YES
WARN_AS_ERROR = NO
WARN_AS_ERROR = YES
WARN_FORMAT = "---> WARNING! $file:$line: $text"
WARN_LOGFILE = doc/warnings.log
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = @SOURCE_DIR@/README.md \
@SOURCE_DIR@/source/lib/omnitrace-user
@SOURCE_DIR@/source/lib/omnitrace-user/omnitrace/types.h \
@SOURCE_DIR@/source/lib/omnitrace-user/omnitrace/categories.h \
@SOURCE_DIR@/source/lib/omnitrace-user/omnitrace/user.h
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.h \
*.hh \
@@ -212,7 +216,7 @@ QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.timemory
ECLIPSE_DOC_ID = org.doxygen.omnitrace
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES
ENUM_VALUES_PER_LINE = 1
@@ -306,9 +310,8 @@ ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH = @SOURCE_DIR@/source/timemory
INCLUDE_PATH = @SOURCE_DIR@/source/lib/omnitrace-user
INCLUDE_FILE_PATTERNS = *.h \
*.hh \
*.hpp
PREDEFINED = OMNITRACE_PUBLIC_API= \
OMNITRACE_HIDDEN_API= \
@@ -316,6 +319,8 @@ PREDEFINED = OMNITRACE_PUBLIC_API= \
"OMNITRACE_VISIBILITY(...)=" \
"__attribute__(x)=" \
"__declspec(x)=" \
"size_t=unsigned long" \
"uintptr_t=unsigned long" \
DOXYGEN_SHOULD_SKIP_THIS
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
+2 -1
Voir le fichier
@@ -19,9 +19,10 @@ cmake -DSOURCE_DIR=${SOURCE_DIR} -P ${WORK_DIR}/generate-doxyfile.cmake
message "Generating doxygen xml files"
doxygen omnitrace.dox
doxygen omnitrace.dox
message "Building html documentation"
make html
make html SPHINXOPTS="-W --keep-going -n"
if [ -d ${SOURCE_DIR}/docs ]; then
message "Removing stale documentation in ${SOURCE_DIR}/docs/"
+34 -13
Voir le fichier
@@ -1,6 +1,8 @@
# User API
```eval_rst
.. doxygenfile:: omnitrace/types.h
.. doxygenfile:: omnitrace/categories.h
.. doxygenfile:: omnitrace/user.h
```
@@ -14,12 +16,16 @@ recorded, regardless of whether whether `omnitrace_user_start_*` or `omnitrace_u
### User API Implementation
```cpp
#include <omnitrace/categories.h>
#include <omnitrace/types.h>
#include <omnitrace/user.h>
#include <atomic>
#include <cassert>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <thread>
#include <vector>
@@ -37,19 +43,16 @@ custom_push_region(const char* name);
namespace
{
int (*omnitrace_push_region_f)(const char*) = nullptr;
}
omnitrace_user_callbacks_t custom_callbacks = OMNITRACE_USER_CALLBACKS_INIT;
omnitrace_user_callbacks_t original_callbacks = OMNITRACE_USER_CALLBACKS_INIT;
} // namespace
int
main(int argc, char** argv)
{
// get the internal callback to start a user-defined region
omnitrace_user_get_callbacks(OMNITRACE_USER_REGION, (void**) &omnitrace_push_region_f,
nullptr);
// assign the custom callback to start a user-defined region
if(omnitrace_push_region_f)
omnitrace_user_configure(OMNITRACE_USER_REGION, (void*) &custom_push_region,
nullptr);
custom_callbacks.push_region = &custom_push_region;
omnitrace_user_configure(OMNITRACE_USER_UNION_CONFIG, custom_callbacks,
&original_callbacks);
omnitrace_user_push_region(argv[0]);
omnitrace_user_push_region("initialization");
@@ -71,9 +74,7 @@ main(int argc, char** argv)
omnitrace_user_stop_thread_trace();
for(size_t i = 0; i < nthread; ++i)
{
size_t _nitr = ((i % 2) == 1) ? (nitr - (0.1 * nitr)) : (nitr + (0.1 * nitr));
long _nfib = ((i % 2) == 1) ? (nfib - (0.1 * nfib)) : (nfib + (0.1 * nfib));
threads.emplace_back(&run, _nitr, _nfib);
threads.emplace_back(&run, nitr, nfib);
}
// re-enable instrumentation
omnitrace_user_start_thread_trace();
@@ -117,8 +118,28 @@ run(size_t nitr, long n)
int
custom_push_region(const char* name)
{
if(!original_callbacks.push_region || !original_callbacks.push_annotated_region)
return OMNITRACE_USER_ERROR_NO_BINDING;
printf("Pushing custom region :: %s\n", name);
return (*omnitrace_push_region_f)(name);
if(original_callbacks.push_annotated_region)
{
int32_t _err = errno;
char* _msg = nullptr;
char _buff[1024];
if(_err != 0) _msg = strerror_r(_err, _buff, sizeof(_buff));
omnitrace_annotation_t _annotations[] = {
{ "errno", OMNITRACE_INT32, &_err }, { "strerror", OMNITRACE_STRING, _msg }
};
errno = 0; // reset errno
return (*original_callbacks.push_annotated_region)(
name, _annotations, sizeof(_annotations) / sizeof(omnitrace_annotation_t));
}
return (*original_callbacks.push_region)(name);
}
```
+9 -7
Voir le fichier
@@ -87,10 +87,11 @@ extern "C"
// be the last enumerated id
} omnitrace_category_t;
/// @typedef omnitrace_annotation_type_t
/// @enum OMNITRACE_ANNOTATION_TYPE
/// @brief Identifier for the data type of the annotation.
/// if the data type is not a pointer, pass the address of
/// data.
/// @typedef OMNITRACE_ANNOTATION_TYPE omnitrace_annotation_type_t
typedef enum OMNITRACE_ANNOTATION_TYPE
{
// Do not use first enum value
@@ -134,15 +135,13 @@ extern "C"
OMNITRACE_VALUE_LAST
} omnitrace_annotation_type_t;
/// @typedef omnitrace_annotation
/// @struct omnitrace_annotation
/// @brief A struct containing annotation data to be included in the perfetto trace.
///
/// @code{.cpp}
/// #include <cstddef>
/// #include <cstdint>
///
/// #include <omnitrace/user.h>
///
/// double
/// compute_residual(size_t n, double* data);
///
@@ -173,12 +172,15 @@ extern "C"
/// return residual;
/// }
/// @endcode
///
/// @typedef omnitrace_annotation omnitrace_annotation_t
typedef struct omnitrace_annotation
{
/// label for annotation
const char* name;
uintptr_t type;
void* value;
/// omnitrace_annotation_type_t
uintptr_t type;
/// data to annotate
void* value;
} omnitrace_annotation_t;
#if defined(__cplusplus)
+23 -40
Voir le fichier
@@ -37,45 +37,10 @@ extern "C"
typedef int (*omnitrace_annotated_region_func_t)(const char*, omnitrace_annotation*,
size_t);
/// @typedef omnitrace_user_callbacks_t
/// @struct omnitrace_user_callbacks
/// @brief Struct containing the callbacks for the user API
/// @code{.cpp}
///
/// #include <cerrno>
/// #include <cstring>
///
/// omnitrace_user_callbacks_t custom_callbacks = OMNITRACE_USER_CALLBACKS_INIT;
/// omnitrace_user_callbacks_t original_callbacks = OMNITRACE_USER_CALLBACKS_INIT;
///
/// // in our custom push region, we are going to redirect the unannotated user push
/// // region to annotate the trace entries with the global errno and if errno is
/// // non-zero, store the message
/// int
/// custom_push_region(const char* name)
/// {
/// if(!original_callbacks.push_annotated_region)
/// return OMNITRACE_USER_ERROR_NO_BINDING;
///
/// int32_t _err = errno;
/// const char* _msg = nullptr;
/// char _buff[1024];
/// if(_err != 0) _msg = strerror_r(_err, _buff, sizeof(_buff));
///
/// omnitrace_annotation_t _annotates[] = { { "errno", OMNITRACE_INT32, &_err },
/// { "msg", OMNITRACE_STRING, _msg } };
/// return (*original_callbacks.push_annotated_region)(name, &_annotations, 2);
/// }
///
/// int
/// main(int argc, char** argv)
/// {
/// custom_callbacks.push_region = &custom_push_region;
/// omnitrace_user_configure(OMNITRACE_USER_UNION_CONFIG, custom_callbacks,
/// &original_callbacks);
/// // ...
/// }
///
/// @endcode
/// @typedef omnitrace_user_callbacks omnitrace_user_callbacks_t
typedef struct omnitrace_user_callbacks
{
omnitrace_trace_func_t start_trace;
@@ -86,11 +51,28 @@ extern "C"
omnitrace_region_func_t pop_region;
omnitrace_annotated_region_func_t push_annotated_region;
omnitrace_annotated_region_func_t pop_annotated_region;
/// @var start_trace
/// @brief callback for enabling tracing globally
/// @var stop_trace
/// @brief callback for disabling tracing globally
/// @var start_thread_trace
/// @brief callback for enabling tracing on current thread
/// @var stop_thread_trace
/// @brief callback for disabling tracing on current thread
/// @var push_region
/// @brief callback for starting a trace region
/// @var pop_region
/// @brief callback for ending a trace region
/// @var push_annotated_region
/// @brief callback for starting a trace region + annotations
/// @var pop_annotated_region
/// @brief callback for ending a trace region + annotations
} omnitrace_user_callbacks_t;
/// @typedef omnitrace_user_configure_mode_t
/// @enum OMNITRACE_USER_CONFIGURE_MODE
/// @brief Identifier for errors
///
/// @typedef OMNITRACE_USER_CONFIGURE_MODE omnitrace_user_configure_mode_t
typedef enum OMNITRACE_USER_CONFIGURE_MODE
{
// clang-format off
@@ -101,8 +83,9 @@ extern "C"
// clang-format on
} omnitrace_user_configure_mode_t;
/// @typedef omnitrace_user_error_t
/// @enum OMNITRACE_USER_ERROR
/// @brief Identifier for errors
/// @typedef OMNITRACE_USER_ERROR omnitrace_user_error_t
///
typedef enum OMNITRACE_USER_ERROR
{
+23 -21
Voir le fichier
@@ -42,36 +42,36 @@ extern "C"
#endif
/// @fn int omnitrace_user_start_trace(void)
/// @return @ref OMNITRACE_USER_ERROR value
/// @return omnitrace_user_error_t value
/// @brief Enable tracing on this thread and all subsequently created threads
extern int omnitrace_user_start_trace(void) OMNITRACE_PUBLIC_API;
/// @fn int omnitrace_user_stop_trace(void)
/// @return @ref OMNITRACE_USER_ERROR value
/// @return omnitrace_user_error_t value
/// @brief Disable tracing on this thread and all subsequently created threads
extern int omnitrace_user_stop_trace(void) OMNITRACE_PUBLIC_API;
/// @fn int omnitrace_user_start_thread_trace(void)
/// @return @ref OMNITRACE_USER_ERROR value
/// @return omnitrace_user_error_t value
/// @brief Enable tracing on this specific thread. Does not apply to subsequently
/// created threads
extern int omnitrace_user_start_thread_trace(void) OMNITRACE_PUBLIC_API;
/// @fn int omnitrace_user_stop_thread_trace(void)
/// @return @ref OMNITRACE_USER_ERROR value
/// @return omnitrace_user_error_t value
/// @brief Disable tracing on this specific thread. Does not apply to subsequently
/// created threads
extern int omnitrace_user_stop_thread_trace(void) OMNITRACE_PUBLIC_API;
/// @fn int omnitrace_user_push_region(const char* id)
/// @param id The string identifier for the region
/// @return @ref OMNITRACE_USER_ERROR value
/// @return omnitrace_user_error_t value
/// @brief Start a user defined region.
extern int omnitrace_user_push_region(const char*) OMNITRACE_PUBLIC_API;
/// @fn int omnitrace_user_pop_region(const char* id)
/// @param id The string identifier for the region
/// @return @ref OMNITRACE_USER_ERROR value
/// @return omnitrace_user_error_t value
/// @brief End a user defined region. In general, user regions should be popped in
/// the inverse order that they were pushed, i.e. first-in, last-out (FILO). The
/// timemory backend was designed to accommodate asynchronous tasking, where FILO may
@@ -80,13 +80,15 @@ extern "C"
/// results in timemory vs. perfetto.
extern int omnitrace_user_pop_region(const char*) OMNITRACE_PUBLIC_API;
/// @typedef omnitrace_annotation omnitrace_annotation_t
///
/// @fn int omnitrace_user_push_annotated_region(const char* id,
/// omnitrace_annotation_t* annotations,
/// size_t num_annotations)
/// @param id The string identifier for the region
/// @param annotations Array of @ref omnitrace_annotation_t instances
/// @param annotations Array of @ref omnitrace_annotation instances
/// @param num_annotations Number of annotations
/// @return @ref OMNITRACE_USER_ERROR value
/// @return omnitrace_user_error_t value
/// @brief Start a user defined region and adds the annotations to the perfetto trace.
extern int omnitrace_user_push_annotated_region(const char*, omnitrace_annotation_t*,
size_t) OMNITRACE_PUBLIC_API;
@@ -95,23 +97,23 @@ extern "C"
/// omnitrace_annotation_t* annotations,
/// size_t num_annotations)
/// @param id The string identifier for the region
/// @param annotations Array of @ref omnitrace_annotation_t instances
/// @param annotations Array of @ref omnitrace_annotation instances
/// @param num_annotations Number of annotations
/// @return @ref OMNITRACE_USER_ERROR value
/// @return omnitrace_user_error_t value
/// @brief Stop a user defined region and adds the annotations to the perfetto trace.
extern int omnitrace_user_pop_annotated_region(const char*, omnitrace_annotation_t*,
size_t) OMNITRACE_PUBLIC_API;
/// @fn int omnitrace_user_configure(omnitrace_user_configure_mode_t cfg,
/// omnitrace_user_callbacks_t new_callbacks,
/// omnitrace_user_callbacks_t* old_callbacks)
/// @param[in] config Specifies how the new callbacks are merged with the old
/// @fn int omnitrace_user_configure(omnitrace_user_configure_mode_t mode,
/// omnitrace_user_callbacks_t inp,
/// omnitrace_user_callbacks_t* out)
/// @param[in] mode Specifies how the new callbacks are merged with the old
/// callbacks
/// @param[in] new_callbacks An @ref omnitrace_user_callbacks_t instance specifying
/// @param[in] inp An @ref omnitrace_user_callbacks instance specifying
/// the callbacks which should be invoked by the user API.
/// @param[out] old_callbacks Pointer to @ref omnitrace_user_callbacks_t which,
/// @param[out] out Pointer to @ref omnitrace_user_callbacks which,
/// when non-NULL, will be assigned the former callbacks.
/// @return @ref omnitrace_user_error_t value
/// @return omnitrace_user_error_t value
/// @brief Configure the function pointers invoked by the omnitrace user API.
/// The initial callbacks are set via the omnitrace-dl library when it is loaded but
/// the user can user this feature to turn on/off the user API or customize how the
@@ -120,8 +122,8 @@ extern "C"
/// regions to the annotated user regions with annotations about some global state.
/// Changing the callbacks is thread-safe but not thread-local.
extern int omnitrace_user_configure(
omnitrace_user_configure_mode_t, omnitrace_user_callbacks_t new_callbacks,
omnitrace_user_callbacks_t* old_callbacks) OMNITRACE_PUBLIC_API;
omnitrace_user_configure_mode_t mode, omnitrace_user_callbacks_t inp,
omnitrace_user_callbacks_t* out) OMNITRACE_PUBLIC_API;
/// @fn int omnitrace_user_get_callbacks(int category, void** begin_func, void**
/// end_func)
@@ -130,7 +132,7 @@ extern "C"
/// the category, e.g. omnitrace_user_start_trace or omnitrace_user_push_region
/// @param[out] end_func The pointer to the function which corresponds to "ending" the
/// category, e.g. omnitrace_user_stop_trace or omnitrace_user_pop_region
/// @return @ref OMNITRACE_USER_ERROR value
/// @return omnitrace_user_error_t value
/// @brief Get the current function pointers for a given category. The initial values
/// are assigned by omnitrace-dl at start up.
extern int omnitrace_user_get_callbacks(omnitrace_user_callbacks_t*)
@@ -138,7 +140,7 @@ extern "C"
/// @fn const char* omnitrace_user_error_string(int error_category)
/// @param error_category OMNITRACE_USER_ERROR value
/// @return @ref OMNITRACE_USER_ERROR value
/// @return String descripting the error code
/// @brief Return a descriptor for the provided error code
extern const char* omnitrace_user_error_string(int) OMNITRACE_PUBLIC_API;
+23 -23
Voir le fichier
@@ -94,17 +94,17 @@ extern "C"
_annotation_count);
}
int omnitrace_user_configure(omnitrace_user_configure_mode_t _mode,
omnitrace_user_callbacks_t _inp,
omnitrace_user_callbacks_t* _out)
int omnitrace_user_configure(omnitrace_user_configure_mode_t mode,
omnitrace_user_callbacks_t inp,
omnitrace_user_callbacks_t* out)
{
auto _former = _callbacks;
switch(_mode)
switch(mode)
{
case OMNITRACE_USER_REPLACE_CONFIG:
{
_callbacks = _inp;
_callbacks = inp;
break;
}
case OMNITRACE_USER_UNION_CONFIG:
@@ -115,14 +115,14 @@ extern "C"
user_callbacks_t _v = _callbacks;
_update(_v.start_trace, _inp.start_trace);
_update(_v.stop_trace, _inp.stop_trace);
_update(_v.start_thread_trace, _inp.start_thread_trace);
_update(_v.stop_thread_trace, _inp.stop_thread_trace);
_update(_v.push_region, _inp.push_region);
_update(_v.pop_region, _inp.pop_region);
_update(_v.push_annotated_region, _inp.push_annotated_region);
_update(_v.pop_annotated_region, _inp.pop_annotated_region);
_update(_v.start_trace, inp.start_trace);
_update(_v.stop_trace, inp.stop_trace);
_update(_v.start_thread_trace, inp.start_thread_trace);
_update(_v.stop_thread_trace, inp.stop_thread_trace);
_update(_v.push_region, inp.push_region);
_update(_v.pop_region, inp.pop_region);
_update(_v.push_annotated_region, inp.push_annotated_region);
_update(_v.pop_annotated_region, inp.pop_annotated_region);
_callbacks = _v;
break;
@@ -135,26 +135,26 @@ extern "C"
user_callbacks_t _v = _callbacks;
_update(_v.start_trace, _inp.start_trace);
_update(_v.stop_trace, _inp.stop_trace);
_update(_v.start_thread_trace, _inp.start_thread_trace);
_update(_v.stop_thread_trace, _inp.stop_thread_trace);
_update(_v.push_region, _inp.push_region);
_update(_v.pop_region, _inp.pop_region);
_update(_v.push_annotated_region, _inp.push_annotated_region);
_update(_v.pop_annotated_region, _inp.pop_annotated_region);
_update(_v.start_trace, inp.start_trace);
_update(_v.stop_trace, inp.stop_trace);
_update(_v.start_thread_trace, inp.start_thread_trace);
_update(_v.stop_thread_trace, inp.stop_thread_trace);
_update(_v.push_region, inp.push_region);
_update(_v.pop_region, inp.pop_region);
_update(_v.push_annotated_region, inp.push_annotated_region);
_update(_v.pop_annotated_region, inp.pop_annotated_region);
_callbacks = _v;
break;
}
default:
{
if(_out) *_out = _former;
if(out) *out = _former;
return OMNITRACE_USER_ERROR_INVALID_CATEGORY;
}
}
if(_out) *_out = _former;
if(out) *out = _former;
return OMNITRACE_USER_SUCCESS;
}