3d0198c395
The range message stack is mirrored in case ranges are pushed or popped while tracing is stopped (by the tracer tool?). When a stop event is reported, the tracer tool emits RangePop events by unwinding the stack, then when the start event is reported, it emits RangePush events again by unwinding the stack. The issue is that the RangePush events should be emitted in reverse order. For example: RangePush(M1); RangePush(M2); \ TracerStop; RangePop; RangePop; \ ...; \ TracerStart; RangePush(M2); RangePush(M1); \ <- In the wrong order RangePop; RangePop; It could be fixed by reversing the stack in RangeStackIterate but is it worth it? The roctx range markers are supposed to be unintrusive so that they can be left in the application even when it isn't being traced. Simplifying the roctx API and reducing its added latency by removing the range message stack mirroring seems like the better choise. TODO: A future change should make roctx events immune to tracer start and tracer stop requests. Or simply remove roctracer_start/stop. Change-Id: Ie4d76afb5ce8d263848dcf1b599af394db56ddab
82 lines
2.4 KiB
C
82 lines
2.4 KiB
C
/* Copyright (c) 2018-2022 Advanced Micro Devices, Inc.
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
THE SOFTWARE. */
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// ROC-TX API
|
|
//
|
|
// ROC-TX library, Code Annotation API.
|
|
// The goal of the implementation is to provide functionality for annotating
|
|
// events, code ranges, and resources in applications.
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef INC_ROCTRACER_ROCTX_H_
|
|
#define INC_ROCTRACER_ROCTX_H_
|
|
#include <roctx.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif // __cplusplus
|
|
|
|
// ROC-TX API ID enumeration
|
|
enum roctx_api_id_t {
|
|
ROCTX_API_ID_roctxMarkA = 0,
|
|
ROCTX_API_ID_roctxRangePushA = 1,
|
|
ROCTX_API_ID_roctxRangePop = 2,
|
|
ROCTX_API_ID_roctxRangeStartA = 3,
|
|
ROCTX_API_ID_roctxRangeStop = 4,
|
|
|
|
ROCTX_API_ID_NUMBER,
|
|
};
|
|
|
|
// ROCTX callbacks data type
|
|
typedef struct roctx_api_data_s {
|
|
union {
|
|
struct {
|
|
const char* message;
|
|
roctx_range_id_t id;
|
|
};
|
|
struct {
|
|
const char* message;
|
|
} roctxMarkA;
|
|
struct {
|
|
const char* message;
|
|
} roctxRangePushA;
|
|
struct {
|
|
const char* message;
|
|
} roctxRangePop;
|
|
struct {
|
|
const char* message;
|
|
roctx_range_id_t id;
|
|
} roctxRangeStartA;
|
|
struct {
|
|
const char* message;
|
|
roctx_range_id_t id;
|
|
} roctxRangeStop;
|
|
} args;
|
|
} roctx_api_data_t;
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C" block
|
|
#endif // __cplusplus
|
|
|
|
#endif // INC_ROCTRACER_ROCTX_H_
|