auxtrace.h (99fa298453495ee23801ab500a5fe0138c260edb) auxtrace.h (e31f0d017ea19fce9f12f084e1c750a0e3b43680)
1/*
2 * auxtrace.h: AUX area trace support
3 * Copyright (c) 2013-2015, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

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

21#include <stddef.h>
22#include <linux/list.h>
23#include <linux/perf_event.h>
24#include <linux/types.h>
25
26#include "../perf.h"
27#include "event.h"
28#include "session.h"
1/*
2 * auxtrace.h: AUX area trace support
3 * Copyright (c) 2013-2015, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

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

21#include <stddef.h>
22#include <linux/list.h>
23#include <linux/perf_event.h>
24#include <linux/types.h>
25
26#include "../perf.h"
27#include "event.h"
28#include "session.h"
29#include "debug.h"
29
30union perf_event;
31struct perf_session;
32struct perf_evlist;
33struct perf_tool;
34struct option;
35struct record_opts;
36struct auxtrace_info_event;

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

285 struct perf_session *session,
286 struct auxtrace_info_event *auxtrace_info,
287 size_t priv_size);
288 void (*free)(struct auxtrace_record *itr);
289 u64 (*reference)(struct auxtrace_record *itr);
290 int (*read_finish)(struct auxtrace_record *itr, int idx);
291};
292
30
31union perf_event;
32struct perf_session;
33struct perf_evlist;
34struct perf_tool;
35struct option;
36struct record_opts;
37struct auxtrace_info_event;

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

286 struct perf_session *session,
287 struct auxtrace_info_event *auxtrace_info,
288 size_t priv_size);
289 void (*free)(struct auxtrace_record *itr);
290 u64 (*reference)(struct auxtrace_record *itr);
291 int (*read_finish)(struct auxtrace_record *itr, int idx);
292};
293
294#ifdef HAVE_AUXTRACE_SUPPORT
295
293static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
294{
295 struct perf_event_mmap_page *pc = mm->userpg;
296#if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
297 u64 head = ACCESS_ONCE(pc->aux_head);
298#else
299 u64 head = __sync_val_compare_and_swap(&pc->aux_head, 0, 0);
300#endif

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

453static inline void auxtrace__free(struct perf_session *session)
454{
455 if (!session->auxtrace)
456 return;
457
458 return session->auxtrace->free(session);
459}
460
296static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
297{
298 struct perf_event_mmap_page *pc = mm->userpg;
299#if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
300 u64 head = ACCESS_ONCE(pc->aux_head);
301#else
302 u64 head = __sync_val_compare_and_swap(&pc->aux_head, 0, 0);
303#endif

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

456static inline void auxtrace__free(struct perf_session *session)
457{
458 if (!session->auxtrace)
459 return;
460
461 return session->auxtrace->free(session);
462}
463
464#else
465
466static inline struct auxtrace_record *
467auxtrace_record__init(struct perf_evlist *evlist __maybe_unused,
468 int *err __maybe_unused)
469{
470 *err = 0;
471 return NULL;
472}
473
474static inline
475void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused)
476{
477}
478
479static inline int
480perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
481 struct perf_tool *tool __maybe_unused,
482 struct perf_session *session __maybe_unused,
483 perf_event__handler_t process __maybe_unused)
484{
485 return -EINVAL;
486}
487
488static inline
489int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused,
490 struct perf_evlist *evlist __maybe_unused,
491 struct record_opts *opts __maybe_unused)
492{
493 return 0;
494}
495
496#define perf_event__process_auxtrace_info 0
497#define perf_event__process_auxtrace 0
498#define perf_event__process_auxtrace_error 0
499
500static inline
501void perf_session__auxtrace_error_inc(struct perf_session *session
502 __maybe_unused,
503 union perf_event *event
504 __maybe_unused)
505{
506}
507
508static inline
509void events_stats__auxtrace_error_warn(const struct events_stats *stats
510 __maybe_unused)
511{
512}
513
514static inline
515int itrace_parse_synth_opts(const struct option *opt __maybe_unused,
516 const char *str __maybe_unused,
517 int unset __maybe_unused)
518{
519 pr_err("AUX area tracing not supported\n");
520 return -EINVAL;
521}
522
523static inline
524int auxtrace__process_event(struct perf_session *session __maybe_unused,
525 union perf_event *event __maybe_unused,
526 struct perf_sample *sample __maybe_unused,
527 struct perf_tool *tool __maybe_unused)
528{
529 return 0;
530}
531
532static inline
533int auxtrace__flush_events(struct perf_session *session __maybe_unused,
534 struct perf_tool *tool __maybe_unused)
535{
536 return 0;
537}
538
539static inline
540void auxtrace__free_events(struct perf_session *session __maybe_unused)
541{
542}
543
544static inline
545void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache __maybe_unused)
546{
547}
548
549static inline
550void auxtrace__free(struct perf_session *session __maybe_unused)
551{
552}
553
554static inline
555int auxtrace_index__write(int fd __maybe_unused,
556 struct list_head *head __maybe_unused)
557{
558 return -EINVAL;
559}
560
561static inline
562int auxtrace_index__process(int fd __maybe_unused,
563 u64 size __maybe_unused,
564 struct perf_session *session __maybe_unused,
565 bool needs_swap __maybe_unused)
566{
567 return -EINVAL;
568}
569
570static inline
571void auxtrace_index__free(struct list_head *head __maybe_unused)
572{
573}
574
575int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
576 struct auxtrace_mmap_params *mp,
577 void *userpg, int fd);
578void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
579void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
580 off_t auxtrace_offset,
581 unsigned int auxtrace_pages,
582 bool auxtrace_overwrite);
583void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
584 struct perf_evlist *evlist, int idx,
585 bool per_cpu);
586
461#endif
587#endif
588
589#endif