Eliminate static inline in api
Change-Id: Ia25636ca4a7e4b6d763ef8d6003845e7d1df5f50
[ROCm/roctracer commit: c837bcad78]
Bu işleme şunda yer alıyor:
@@ -376,14 +376,9 @@ typedef activity_record_t roctracer_record_t;
|
|||||||
* @retval ::ROCTRACER_STATUS_SUCCESS The function has been executed
|
* @retval ::ROCTRACER_STATUS_SUCCESS The function has been executed
|
||||||
* successfully.
|
* successfully.
|
||||||
*/
|
*/
|
||||||
// Return next record
|
roctracer_status_t roctracer_next_record(
|
||||||
static inline roctracer_status_t roctracer_next_record(
|
const activity_record_t* record,
|
||||||
const activity_record_t* record, // [in] record ptr
|
const activity_record_t** next);
|
||||||
const activity_record_t** next) // [out] next record ptr
|
|
||||||
{
|
|
||||||
*next = record + 1;
|
|
||||||
return ROCTRACER_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memory pool allocator callback.
|
* Memory pool allocator callback.
|
||||||
@@ -506,11 +501,7 @@ roctracer_status_t roctracer_open_pool_expl(
|
|||||||
* @retval ROCTRACER_STATUS_ERROR The default pool is already defined. Unable
|
* @retval ROCTRACER_STATUS_ERROR The default pool is already defined. Unable
|
||||||
* to create the pool.
|
* to create the pool.
|
||||||
*/
|
*/
|
||||||
static inline roctracer_status_t roctracer_open_pool(
|
roctracer_status_t roctracer_open_pool(const roctracer_properties_t* properties);
|
||||||
const roctracer_properties_t* properties)
|
|
||||||
{
|
|
||||||
return roctracer_open_pool_expl(properties, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close tracer memory pool.
|
* Close tracer memory pool.
|
||||||
@@ -538,7 +529,7 @@ roctracer_status_t roctracer_close_pool_expl(
|
|||||||
* @retval ::ROCTRACER_STATUS_SUCCESS The function has been executed
|
* @retval ::ROCTRACER_STATUS_SUCCESS The function has been executed
|
||||||
* successfully or there is no default pool.
|
* successfully or there is no default pool.
|
||||||
*/
|
*/
|
||||||
static inline roctracer_status_t roctracer_close_pool() { return roctracer_close_pool_expl(NULL); }
|
roctracer_status_t roctracer_close_pool();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query and set the default memory pool.
|
* Query and set the default memory pool.
|
||||||
@@ -559,9 +550,7 @@ roctracer_pool_t* roctracer_default_pool_expl(
|
|||||||
*
|
*
|
||||||
* @return Return the current default memory pool, or NULL is none is defined.
|
* @return Return the current default memory pool, or NULL is none is defined.
|
||||||
*/
|
*/
|
||||||
static inline roctracer_pool_t* roctracer_default_pool() {
|
roctracer_pool_t* roctracer_default_pool();
|
||||||
return roctracer_default_pool_expl(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable activity record logging for a specified operation of a domain
|
* Enable activity record logging for a specified operation of a domain
|
||||||
@@ -597,12 +586,9 @@ roctracer_status_t roctracer_enable_op_activity_expl(
|
|||||||
*
|
*
|
||||||
* @retval ROCTRACER_STATUS_ERROR No default pool is defined.
|
* @retval ROCTRACER_STATUS_ERROR No default pool is defined.
|
||||||
*/
|
*/
|
||||||
static inline roctracer_status_t roctracer_enable_op_activity(
|
roctracer_status_t roctracer_enable_op_activity(
|
||||||
activity_domain_t domain,
|
activity_domain_t domain,
|
||||||
uint32_t op)
|
uint32_t op);
|
||||||
{
|
|
||||||
return roctracer_enable_op_activity_expl(domain, op, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable activity record logging for all operations of a domain providing a
|
* Enable activity record logging for all operations of a domain providing a
|
||||||
@@ -619,8 +605,8 @@ static inline roctracer_status_t roctracer_enable_op_activity(
|
|||||||
* @retval ROCTRACER_STATUS_ERROR \p pool is NULL and no default pool is defined.
|
* @retval ROCTRACER_STATUS_ERROR \p pool is NULL and no default pool is defined.
|
||||||
*/
|
*/
|
||||||
roctracer_status_t roctracer_enable_domain_activity_expl(
|
roctracer_status_t roctracer_enable_domain_activity_expl(
|
||||||
activity_domain_t domain, // tracing domain
|
activity_domain_t domain,
|
||||||
roctracer_pool_t* pool); // memory pool, NULL is a default one
|
roctracer_pool_t* pool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable activity record logging for all operations of a domain using the
|
* Enable activity record logging for all operations of a domain using the
|
||||||
@@ -633,11 +619,7 @@ roctracer_status_t roctracer_enable_domain_activity_expl(
|
|||||||
*
|
*
|
||||||
* @retval ROCTRACER_STATUS_ERROR No default pool is defined.
|
* @retval ROCTRACER_STATUS_ERROR No default pool is defined.
|
||||||
*/
|
*/
|
||||||
static inline roctracer_status_t roctracer_enable_domain_activity(
|
roctracer_status_t roctracer_enable_domain_activity(activity_domain_t domain);
|
||||||
activity_domain_t domain)
|
|
||||||
{
|
|
||||||
return roctracer_enable_domain_activity_expl(domain, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable activity record logging for all operations of all domains providing a
|
* Enable activity record logging for all operations of all domains providing a
|
||||||
@@ -663,9 +645,7 @@ roctracer_status_t roctracer_enable_activity_expl(
|
|||||||
*
|
*
|
||||||
* @retval ROCTRACER_STATUS_ERROR No default pool is defined.
|
* @retval ROCTRACER_STATUS_ERROR No default pool is defined.
|
||||||
*/
|
*/
|
||||||
static inline roctracer_status_t roctracer_enable_activity() {
|
roctracer_status_t roctracer_enable_activity();
|
||||||
return roctracer_enable_activity_expl(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable activity record logging for a specified operation of a domain.
|
* Disable activity record logging for a specified operation of a domain.
|
||||||
@@ -727,9 +707,7 @@ roctracer_status_t roctracer_flush_activity_expl(
|
|||||||
* @retval ::ROCTRACER_STATUS_SUCCESS The function has been executed
|
* @retval ::ROCTRACER_STATUS_SUCCESS The function has been executed
|
||||||
* successfully.
|
* successfully.
|
||||||
*/
|
*/
|
||||||
static inline roctracer_status_t roctracer_flush_activity() {
|
roctracer_status_t roctracer_flush_activity();
|
||||||
return roctracer_flush_activity_expl(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@@ -807,10 +807,14 @@ PUBLIC_API roctracer_pool_t* roctracer_default_pool_expl(roctracer_pool_t* pool)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_pool_t* roctracer_default_pool() {
|
||||||
|
std::lock_guard lock(memory_pool_mutex);
|
||||||
|
return reinterpret_cast<roctracer_pool_t*>(default_memory_pool);
|
||||||
|
}
|
||||||
|
|
||||||
// Open memory pool
|
// Open memory pool
|
||||||
PUBLIC_API roctracer_status_t roctracer_open_pool_expl(const roctracer_properties_t* properties,
|
static void roctracer_open_pool_impl(const roctracer_properties_t* properties,
|
||||||
roctracer_pool_t** pool) {
|
roctracer_pool_t** pool) {
|
||||||
API_METHOD_PREFIX
|
|
||||||
std::lock_guard lock(memory_pool_mutex);
|
std::lock_guard lock(memory_pool_mutex);
|
||||||
if ((pool == nullptr) && (default_memory_pool != nullptr)) {
|
if ((pool == nullptr) && (default_memory_pool != nullptr)) {
|
||||||
EXC_RAISING(ROCTRACER_STATUS_ERROR, "default pool already set");
|
EXC_RAISING(ROCTRACER_STATUS_ERROR, "default pool already set");
|
||||||
@@ -821,9 +825,31 @@ PUBLIC_API roctracer_status_t roctracer_open_pool_expl(const roctracer_propertie
|
|||||||
*pool = p;
|
*pool = p;
|
||||||
else
|
else
|
||||||
default_memory_pool = p;
|
default_memory_pool = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_open_pool_expl(const roctracer_properties_t* properties,
|
||||||
|
roctracer_pool_t** pool) {
|
||||||
|
API_METHOD_PREFIX
|
||||||
|
roctracer_open_pool_impl(properties, pool);
|
||||||
API_METHOD_SUFFIX
|
API_METHOD_SUFFIX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_open_pool(
|
||||||
|
const roctracer_properties_t* properties)
|
||||||
|
{
|
||||||
|
API_METHOD_PREFIX
|
||||||
|
roctracer_open_pool_impl(properties, nullptr);
|
||||||
|
API_METHOD_SUFFIX
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_next_record(
|
||||||
|
const activity_record_t* record,
|
||||||
|
const activity_record_t** next)
|
||||||
|
{
|
||||||
|
*next = record + 1;
|
||||||
|
return ROCTRACER_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// Enable activity records logging
|
// Enable activity records logging
|
||||||
static roctracer_status_t roctracer_enable_activity_fun(roctracer_domain_t domain, uint32_t op,
|
static roctracer_status_t roctracer_enable_activity_fun(roctracer_domain_t domain, uint32_t op,
|
||||||
roctracer_pool_t* pool) {
|
roctracer_pool_t* pool) {
|
||||||
@@ -901,22 +927,49 @@ PUBLIC_API roctracer_status_t roctracer_enable_op_activity_expl(roctracer_domain
|
|||||||
API_METHOD_SUFFIX
|
API_METHOD_SUFFIX
|
||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC_API roctracer_status_t roctracer_enable_domain_activity_expl(roctracer_domain_t domain,
|
PUBLIC_API roctracer_status_t roctracer_enable_op_activity(activity_domain_t domain, uint32_t op) {
|
||||||
roctracer_pool_t* pool) {
|
|
||||||
API_METHOD_PREFIX
|
API_METHOD_PREFIX
|
||||||
const uint32_t op_end = get_op_end(domain);
|
roctracer_enable_activity_impl(domain, op, nullptr);
|
||||||
for (uint32_t op = get_op_begin(domain); op < op_end; ++op)
|
|
||||||
roctracer_enable_activity_impl(domain, op, pool);
|
|
||||||
API_METHOD_SUFFIX
|
API_METHOD_SUFFIX
|
||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC_API roctracer_status_t roctracer_enable_activity_expl(roctracer_pool_t* pool) {
|
static void roctracer_enable_domain_activity_impl(roctracer_domain_t domain,
|
||||||
|
roctracer_pool_t* pool) {
|
||||||
|
const uint32_t op_end = get_op_end(domain);
|
||||||
|
for (uint32_t op = get_op_begin(domain); op < op_end; ++op)
|
||||||
|
roctracer_enable_activity_impl(domain, op, pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_enable_domain_activity_expl(roctracer_domain_t domain,
|
||||||
|
roctracer_pool_t* pool) {
|
||||||
API_METHOD_PREFIX
|
API_METHOD_PREFIX
|
||||||
|
roctracer_enable_domain_activity_impl(domain, pool);
|
||||||
|
API_METHOD_SUFFIX
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_enable_domain_activity(activity_domain_t domain) {
|
||||||
|
API_METHOD_PREFIX
|
||||||
|
roctracer_enable_domain_activity_impl(domain, nullptr);
|
||||||
|
API_METHOD_SUFFIX
|
||||||
|
}
|
||||||
|
|
||||||
|
static void roctracer_enable_activity_impl(roctracer_pool_t* pool) {
|
||||||
for (uint32_t domain = 0; domain < ACTIVITY_DOMAIN_NUMBER; ++domain) {
|
for (uint32_t domain = 0; domain < ACTIVITY_DOMAIN_NUMBER; ++domain) {
|
||||||
const uint32_t op_end = get_op_end(domain);
|
const uint32_t op_end = get_op_end(domain);
|
||||||
for (uint32_t op = get_op_begin(domain); op < op_end; ++op)
|
for (uint32_t op = get_op_begin(domain); op < op_end; ++op)
|
||||||
roctracer_enable_activity_impl((roctracer_domain_t)domain, op, pool);
|
roctracer_enable_activity_impl((roctracer_domain_t)domain, op, pool);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_enable_activity_expl(roctracer_pool_t* pool) {
|
||||||
|
API_METHOD_PREFIX
|
||||||
|
roctracer_enable_activity_impl(pool);
|
||||||
|
API_METHOD_SUFFIX
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_enable_activity() {
|
||||||
|
API_METHOD_PREFIX
|
||||||
|
roctracer_enable_activity_impl(nullptr);
|
||||||
API_METHOD_SUFFIX
|
API_METHOD_SUFFIX
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1004,34 +1057,53 @@ PUBLIC_API roctracer_status_t roctracer_disable_activity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close memory pool
|
// Close memory pool
|
||||||
PUBLIC_API roctracer_status_t roctracer_close_pool_expl(roctracer_pool_t* pool) {
|
static void roctracer_close_pool_impl(roctracer_pool_t* pool) {
|
||||||
API_METHOD_PREFIX
|
|
||||||
std::lock_guard lock(memory_pool_mutex);
|
std::lock_guard lock(memory_pool_mutex);
|
||||||
if (pool == nullptr) pool = reinterpret_cast<roctracer_pool_t*>(default_memory_pool);
|
if (pool == nullptr) pool = reinterpret_cast<roctracer_pool_t*>(default_memory_pool);
|
||||||
if (pool != nullptr) {
|
if (pool == nullptr) return;
|
||||||
MemoryPool* p = reinterpret_cast<MemoryPool*>(pool);
|
MemoryPool* p = reinterpret_cast<MemoryPool*>(pool);
|
||||||
if (p == default_memory_pool) default_memory_pool = nullptr;
|
if (p == default_memory_pool) default_memory_pool = nullptr;
|
||||||
|
|
||||||
// Disable any activities that specify the pool being deleted.
|
// Disable any activities that specify the pool being deleted.
|
||||||
std::vector<std::pair<roctracer_domain_t, uint32_t>> ops;
|
std::vector<std::pair<roctracer_domain_t, uint32_t>> ops;
|
||||||
act_journal.ForEach(
|
act_journal.ForEach(
|
||||||
[&ops, pool](roctracer_domain_t domain, uint32_t op, const ActivityJournalData& data) {
|
[&ops, pool](roctracer_domain_t domain, uint32_t op, const ActivityJournalData& data) {
|
||||||
if (pool == data.pool) ops.emplace_back(domain, op);
|
if (pool == data.pool) ops.emplace_back(domain, op);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
for (auto&& [domain, op] : ops) roctracer_disable_activity_impl(domain, op);
|
for (auto&& [domain, op] : ops) roctracer_disable_activity_impl(domain, op);
|
||||||
|
|
||||||
delete (p);
|
delete (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_close_pool_expl(roctracer_pool_t* pool) {
|
||||||
|
API_METHOD_PREFIX
|
||||||
|
roctracer_close_pool_impl(pool);
|
||||||
API_METHOD_SUFFIX
|
API_METHOD_SUFFIX
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush available activity records
|
PUBLIC_API roctracer_status_t roctracer_close_pool() {
|
||||||
PUBLIC_API roctracer_status_t roctracer_flush_activity_expl(roctracer_pool_t* pool) {
|
|
||||||
API_METHOD_PREFIX
|
API_METHOD_PREFIX
|
||||||
|
roctracer_close_pool_impl(NULL);
|
||||||
|
API_METHOD_SUFFIX
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush available activity records
|
||||||
|
static void roctracer_flush_activity_impl(roctracer_pool_t* pool) {
|
||||||
if (pool == nullptr) pool = roctracer_default_pool();
|
if (pool == nullptr) pool = roctracer_default_pool();
|
||||||
MemoryPool* default_memory_pool = reinterpret_cast<MemoryPool*>(pool);
|
MemoryPool* default_memory_pool = reinterpret_cast<MemoryPool*>(pool);
|
||||||
if (default_memory_pool != nullptr) default_memory_pool->Flush();
|
if (default_memory_pool != nullptr) default_memory_pool->Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_flush_activity_expl(roctracer_pool_t* pool) {
|
||||||
|
API_METHOD_PREFIX
|
||||||
|
roctracer_flush_activity_impl(pool);
|
||||||
|
API_METHOD_SUFFIX
|
||||||
|
}
|
||||||
|
|
||||||
|
PUBLIC_API roctracer_status_t roctracer_flush_activity() {
|
||||||
|
API_METHOD_PREFIX
|
||||||
|
roctracer_flush_activity_impl(nullptr);
|
||||||
API_METHOD_SUFFIX
|
API_METHOD_SUFFIX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Yeni konuda referans
Bir kullanıcı engelle