Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #1 #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions uncore_perf_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ static uint64_t (*wtime)(void) = NULL;
static size_t buf_size = DEFAULT_BUF_SIZE; // 4MB per Event per Thread
static int interval_us = 100000; // 100ms

char* env(const char* name)
{
int name_len = strlen(name);
int scorep_len = strlen("SCOREP_METRIC_");
char* scorep_name = malloc((name_len + scorep_len + 1) * sizeof(char));
sprintf(scorep_name, "%s%s", "SCOREP_METRIC_", name);
char* ret = getenv(scorep_name);
if (ret == NULL)
{
ret = getenv(name);
}
return ret;
}
void set_pform_wtime_function(uint64_t (*pform_wtime)(void))
{
wtime = pform_wtime;
Expand Down Expand Up @@ -191,7 +204,7 @@ int32_t init(void)
/* get number of packages */
node_num = x86_energy_get_nr_packages();

env_string = getenv("UPE_INTERVAL_US");
env_string = env("UPE_INTERVAL_US");
if (env_string == NULL)
interval_us = 100000;
else
Expand All @@ -204,7 +217,7 @@ int32_t init(void)
}
}

env_string = getenv("UPE_BUF_SIZE");
env_string = env("UPE_BUF_SIZE");
if (env_string != NULL)
{
buf_size = parse_buffer_size(env_string);
Expand All @@ -217,7 +230,7 @@ int32_t init(void)
}

#if defined(BACKEND_SCOREP)
env_string = getenv("UPE_SEP");
env_string = env("UPE_SEP");
if (env_string != NULL)
{
vt_sep = env_string[0];
Expand Down