parse-events.c (dd9a9ad5e1e94894433110ccbf492ed60d75ffcb) parse-events.c (ad7f4e3f7b966ac09c8f98dbc5024813a1685775)
1#include "../../../include/linux/hw_breakpoint.h"
2#include "util.h"
3#include "../perf.h"
4#include "evsel.h"
5#include "parse-options.h"
6#include "parse-events.h"
7#include "exec_cmd.h"
8#include "string.h"

--- 476 unchanged lines hidden (view full) ---

485
486 if (parse_events(NULL, event_opt, 0))
487 return EVT_FAILED;
488 }
489
490 return EVT_HANDLED_ALL;
491}
492
1#include "../../../include/linux/hw_breakpoint.h"
2#include "util.h"
3#include "../perf.h"
4#include "evsel.h"
5#include "parse-options.h"
6#include "parse-events.h"
7#include "exec_cmd.h"
8#include "string.h"

--- 476 unchanged lines hidden (view full) ---

485
486 if (parse_events(NULL, event_opt, 0))
487 return EVT_FAILED;
488 }
489
490 return EVT_HANDLED_ALL;
491}
492
493static int store_event_type(const char *orgname)
494{
495 char filename[PATH_MAX], *c;
496 FILE *file;
497 int id, n;
498
499 sprintf(filename, "%s/", debugfs_path);
500 strncat(filename, orgname, strlen(orgname));
501 strcat(filename, "/id");
502
503 c = strchr(filename, ':');
504 if (c)
505 *c = '/';
506
507 file = fopen(filename, "r");
508 if (!file)
509 return 0;
510 n = fscanf(file, "%i", &id);
511 fclose(file);
512 if (n < 1) {
513 pr_err("cannot store event ID\n");
514 return -EINVAL;
515 }
516 return perf_header__push_event(id, orgname);
517}
518
519static enum event_result parse_tracepoint_event(const char **strp,
520 struct perf_event_attr *attr)
521{
522 const char *evt_name;
523 char *flags = NULL, *comma_loc;
524 char sys_name[MAX_EVENT_LENGTH];
525 unsigned int sys_length, evt_length;
526

--- 27 unchanged lines hidden (view full) ---

554 evt_length = strlen(evt_name);
555 if (evt_length >= MAX_EVENT_LENGTH)
556 return EVT_FAILED;
557 if (strpbrk(evt_name, "*?")) {
558 *strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */
559 return parse_multiple_tracepoint_event(sys_name, evt_name,
560 flags);
561 } else {
493static enum event_result parse_tracepoint_event(const char **strp,
494 struct perf_event_attr *attr)
495{
496 const char *evt_name;
497 char *flags = NULL, *comma_loc;
498 char sys_name[MAX_EVENT_LENGTH];
499 unsigned int sys_length, evt_length;
500

--- 27 unchanged lines hidden (view full) ---

528 evt_length = strlen(evt_name);
529 if (evt_length >= MAX_EVENT_LENGTH)
530 return EVT_FAILED;
531 if (strpbrk(evt_name, "*?")) {
532 *strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */
533 return parse_multiple_tracepoint_event(sys_name, evt_name,
534 flags);
535 } else {
562 if (store_event_type(evt_name) < 0)
563 return EVT_FAILED;
564
565 return parse_single_tracepoint_event(sys_name, evt_name,
566 evt_length, attr, strp);
567 }
568}
569
570static enum event_result
571parse_breakpoint_type(const char *type, const char **strp,
572 struct perf_event_attr *attr)

--- 470 unchanged lines hidden ---
536 return parse_single_tracepoint_event(sys_name, evt_name,
537 evt_length, attr, strp);
538 }
539}
540
541static enum event_result
542parse_breakpoint_type(const char *type, const char **strp,
543 struct perf_event_attr *attr)

--- 470 unchanged lines hidden ---