1 /* 2 * Copyright (c) 2012,2013,2018 Intel Corporation 3 * Author: Andi Kleen 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and 9 * this paragraph in its entirety in the documentation or other materials 10 * provided with the distribution 11 * 12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 13 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 15 */ 16 17 #ifndef RDPMC_H 18 #define RDPMC_H 19 20 #if HAVE_LINUX_PERF_RDPMC 21 22 #include <linux/perf_event.h> 23 #include <ofi_perf.h> 24 25 26 struct rdpmc_ctx { 27 int fd; 28 struct perf_event_mmap_page *buf; 29 }; 30 31 int rdpmc_open(unsigned counter, struct rdpmc_ctx *ctx); 32 int rdpmc_open_attr(struct perf_event_attr *attr, struct rdpmc_ctx *ctx, 33 struct rdpmc_ctx *leader_ctx); 34 void rdpmc_close(struct rdpmc_ctx *ctx); 35 unsigned long long rdpmc_read(struct rdpmc_ctx *ctx); 36 37 38 struct ofi_perf_ctx { 39 struct rdpmc_ctx ctx; 40 }; 41 42 43 #endif /* HAVE_LINUX_PERF_RDPMC */ 44 45 #endif 46