Skip to content

Commit

Permalink
Updating to latest perfstubs API
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Feb 26, 2020
1 parent 821b859 commit d2648d8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ git_external(perfstubs

find_file(
PERFSTUBS_HEADER
NAMES perfstubs_api/Tool.h
NAMES perfstubs_api/tool.h
PATHS ${PROJECT_SOURCE_DIR}/perfstubs)

if(PERFSTUBS_HEADER)
Expand Down Expand Up @@ -817,7 +817,7 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/pkgconfig/apex.pc.in
${CMAKE_BINARY_DIR}/pkgconfig/apex.pc @ONLY)
INSTALL_FILES(/lib/pkgconfig FILES pkgconfig/apex.pc)

if (APEX_USE_WEAK_SYMBOLS)
if (APEX_USE_WEAK_SYMBOLS)
add_definitions(-DAPEX_USE_WEAK_SYMBOLS)
else()
find_library(DYNAMICLIB dl)
Expand Down
46 changes: 23 additions & 23 deletions src/apex/perftool_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include "perfstubs/perfstubs_api/Tool.h"
#include "perfstubs/perfstubs_api/tool.h"
#include <stdlib.h>
#include "apex.h"
#include "thread_instance.hpp"
Expand All @@ -15,54 +15,54 @@ std::mutex my_mutex;

extern "C" {
// library function declarations
void perftool_init(void) {
void ps_initialize(void) {
apex_init("PerfStubs API", 0, 1);
}
void perftool_register_thread(void) {
void ps_register_thread(void) {
apex_register_thread("PerfStubs Thread");
}
void perftool_exit(void) {
void ps_finalize(void) {
apex_exit_thread();
}
void perftool_dump(void) {
void ps_dump_data(void) {
apex_dump(false);
}

// measurement function declarations
void* perftool_timer_create(const char *timer_name) {
void* ps_timer_create(const char *timer_name) {
return strdup(timer_name);
}
void perftool_timer_start(const void *timer) {
void ps_timer_start(const void *timer) {
apex_start(APEX_NAME_STRING, const_cast<void*>(timer));
}
void perftool_timer_stop(const void *timer) {
void ps_timer_stop(const void *timer) {
apex_stop(apex::thread_instance::instance().get_current_profiler());
}
void perftool_dynamic_phase_start(const char *iteration_prefix,
void ps_dynamic_phase_start(const char *iteration_prefix,
int iteration_number) {
std::stringstream ss;
ss << iteration_prefix << " " << iteration_number;
apex_start(APEX_NAME_STRING, (void*)const_cast<char*>(ss.str().c_str()));
}
void perftool_dynamic_phase_stop(const char *iteration_prefix,
void ps_dynamic_phase_stop(const char *iteration_prefix,
int iteration_number) {
apex_stop(apex::thread_instance::instance().get_current_profiler());
}
void* perftool_create_counter(const char *counter_name) {
void* ps_create_counter(const char *counter_name) {
return (void*)(strdup(counter_name));
}
void perftool_sample_counter(const void *counter, double value) {
void ps_sample_counter(const void *counter, double value) {
apex_sample_value((const char *)(counter), value);
}
void perftool_metadata(const char *name, const char *value) {
void ps_set_metadata(const char *name, const char *value) {
// do nothing
}

// data query function declarations
void perftool_get_timer_data(perftool_timer_data_t *timer_data) {
memset(timer_data, 0, sizeof(perftool_timer_data_t));
void ps_get_timer_data(ps_tool_timer_data_t *timer_data) {
memset(timer_data, 0, sizeof(ps_tool_timer_data_t));
}
void perftool_free_timer_data(perftool_timer_data_t *timer_data) {
void ps_free_timer_data(ps_tool_timer_data_t *timer_data) {
if (timer_data == nullptr)
{
return;
Expand All @@ -83,12 +83,12 @@ extern "C" {
timer_data->values = nullptr;
}
}
void perftool_get_counter_data(perftool_counter_data_t *counter_data) {
memset(counter_data, 0, sizeof(perftool_counter_data_t));
void ps_get_counter_data(ps_tool_counter_data_t *counter_data) {
memset(counter_data, 0, sizeof(ps_tool_counter_data_t));
}
void perftool_free_counter_data(perftool_counter_data_t *counter_data) {
void ps_free_counter_data(ps_tool_counter_data_t *counter_data) {
if (counter_data == nullptr)
{
{
return;
}
if (counter_data->counter_names != nullptr)
Expand Down Expand Up @@ -122,10 +122,10 @@ extern "C" {
counter_data->value_sumsqr = nullptr;
}
}
void perftool_get_metadata(perftool_metadata_t *metadata) {
memset(metadata, 0, sizeof(perftool_metadata_t));
void ps_get_metadata(ps_tool_metadata_t *metadata) {
memset(metadata, 0, sizeof(ps_tool_metadata_t));
}
void perftool_free_metadata(perftool_metadata_t *metadata) {
void ps_free_metadata(ps_tool_metadata_t *metadata) {
if (metadata == nullptr)
{
return;
Expand Down

0 comments on commit d2648d8

Please sign in to comment.