58 #define MIN(a,b) (((a)<=(b))?(a):(b)) 60 #define EVENT_DELIMITER '@' 61 #define PREFIX_FREQUENCY 'f' 104 const char *input_string,
111 if (input_string ==
NULL) {
112 *threshold = default_value;
123 long value = strtol(input_string, &endptr, 10);
129 if (endptr == input_string) {
130 value = default_value;
159 unsigned int threshold_pos = 0;
160 unsigned int len = strlen(in);
164 dlm = strrchr(in,
':');
169 len =
MIN(dlm - in, evlen);
170 strncpy(ev, in, len);
176 len =
MIN(dlm - in, evlen);
180 strncpy(ev, in, len);
196 return (strstr(candidate, event_name) == candidate) && strchr(
"@:",candidate[strlen(event_name)]);
202 main (
int argc,
char *argv[])
204 const char *tokens[]={
"one",
"two@",
"three@3",
"four@f4",
"five@f",
"six@s",
"seven::perf",
205 "perf::eight@",
"perf::nine@f200",
"perf:ten@10" };
211 for(i=0; i<elem; i++) {
213 printf(
"%d: %s --> ev: %s, t: %ld, r: %d\n", i, tokens[i], ev, th, res);
void MONITOR_EXT_WRAP_NAME() free(void *ptr)
char * start_tok(char *lst)
int main(int argc, char *argv[])
bool hpcrun_ev_is(const char *candidate, const char *event_name)
int hpcrun_extract_ev_thresh(const char *in, int evlen, char *ev, long *th, long def)
static int const threshold
int hpcrun_extract_threshold(const char *input_string, long *threshold, long default_value)