cvmx-profiler.h revision 232809
1129203Scognet/***********************license start*************** 2129203Scognet * Copyright (c) 2011 Cavium Inc. (support@cavium.com). All rights 3129203Scognet * reserved. 4129203Scognet * 5129203Scognet * 6129203Scognet * Redistribution and use in source and binary forms, with or without 7129203Scognet * modification, are permitted provided that the following conditions are 8129203Scognet * met: 9129203Scognet * 10129203Scognet * * Redistributions of source code must retain the above copyright 11129203Scognet * notice, this list of conditions and the following disclaimer. 12129203Scognet * 13129203Scognet * * Redistributions in binary form must reproduce the above 14129203Scognet * copyright notice, this list of conditions and the following 15129203Scognet * disclaimer in the documentation and/or other materials provided 16129203Scognet * with the distribution. 17129203Scognet * 18129203Scognet * * Neither the name of Cavium Inc. nor the names of 19129203Scognet * its contributors may be used to endorse or promote products 20129203Scognet * derived from this software without specific prior written 21129203Scognet * permission. 22129203Scognet * 23129203Scognet * This Software, including technical data, may be subject to U.S. export control 24129203Scognet * laws, including the U.S. Export Administration Act and its associated 25129203Scognet * regulations, and may be subject to export or import regulations in other 26129203Scognet * countries. 27129203Scognet * 28129203Scognet * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 29129203Scognet * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR 30129203Scognet * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO 31129203Scognet * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR 32129203Scognet * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM 33129203Scognet * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, 34129203Scognet * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF 35129203Scognet * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR 36129203Scognet * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR 37129203Scognet * PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 38129203Scognet *************************license end**************************************/ 39129203Scognet 40129203Scognet/** 41129203Scognet * @file 42129203Scognet * 43129203Scognet * Header file for the event Profiler. 44 * 45 */ 46 47#ifndef __CVMX_PROFILER_H__ 48#define __CVMX_PROFILER_H__ 49 50#ifdef __cplusplus 51extern "C" { 52#endif 53 54#define EVENT_PERCPU_BUFFER_SIZE 8192 55#define PADBYTES 24 56 57#define EVENT_BUFFER_BLOCK "event_block" 58#define EVENT_BUFFER_SIZE EVENT_PERCPU_BUFFER_SIZE * (cvmx_octeon_num_cores() + 1) 59 60#define EVENT_BUFFER_CONFIG_BLOCK "event_config_block" 61#define EBC_BLOCK_SIZE 256 62 63typedef struct { 64 int core; 65 uint32_t pc; 66} cvmx_sample_entry_t; 67 68typedef struct cpu_event_block { 69 int size; 70 int sample_read; 71 int64_t max_samples; 72 int64_t sample_count; 73 char *head; 74 char *tail; 75 char *end; 76 char *data; 77} cvmx_cpu_event_block_t; 78 79typedef struct { 80 cvmx_cpu_event_block_t pcpu_blk_info; 81 char *pcpu_data; 82} cvmx_ringbuf_t; 83 84typedef struct config_block { 85 int64_t sample_count; 86 uint64_t events; 87 char *pcpu_base_addr[CVMX_MAX_CORES]; 88} cvmx_config_block_t; 89 90typedef struct event_counter_control_block { 91 int32_t read_cfg_blk; 92 char *config_blk_base_addr; 93 cvmx_config_block_t cfg_blk; 94} event_counter_control_block_t; 95 96extern void cvmx_update_perfcnt_irq(void); 97extern void cvmx_collect_sample(void); 98 99#ifdef __cplusplus 100} 101#endif 102 103#endif /* __CVMX_PROFILER_H__ */ 104