openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

shr_bprof.h (3211B)


      1 /* 
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        shr_bprof.h
      8  * Purpose:     Defines profiling tool data structures 
      9  * Usage:   define enum for the profiling section of code and add entry for 
     10  * corresponding text in shr_bprof.c and use SHR_BPROF_STATS_TIME()
     11  */
     12 #ifndef _SHR_BPROF_H
     13 #define _SHR_BPROF_H
     14 
     15 #include <sal/core/time.h>
     16 
     17 #define SHR_BPROF_STATS_MAX_NAME     80
     18 
     19 typedef struct shr_bprof_stats_entry_s {
     20     sal_usecs_t start_stime;
     21     sal_usecs_t total_stime;
     22     sal_usecs_t max_stime;
     23     sal_usecs_t min_stime;
     24     uint32 runs;
     25 } shr_bprof_stats_entry_t;
     26 
     27 /* This should match with _bprof_stats_names in shr_bprof.c */
     28 typedef enum shr_bprof_type_e {
     29     SHR_BPROF_SOC_PROBE = 0,
     30     SHR_BPROF_SOC_ATTACH,
     31     SHR_BPROF_SOC_INIT, 
     32     SHR_BPROF_SOC_MISC,
     33     SHR_BPROF_SOC_MMU,
     34     SHR_BPROF_BCM_INIT,
     35     SHR_BPROF_BCM_COMMON,
     36     SHR_BPROF_BCM_PORT,
     37     SHR_BPROF_BCM_L2,
     38     SHR_BPROF_BCM_STG,
     39     SHR_BPROF_BCM_VLAN,
     40     SHR_BPROF_BCM_TRUNK,
     41     SHR_BPROF_BCM_COSQ,
     42     SHR_BPROF_BCM_MCAST,
     43     SHR_BPROF_BCM_LINKSCAN,
     44     SHR_BPROF_BCM_STAT,
     45     SHR_BPROF_BCM_STK,
     46     SHR_BPROF_BCM_RATE,
     47     SHR_BPROF_BCM_KNET,
     48     SHR_BPROF_BCM_FIELD,
     49     SHR_BPROF_BCM_MIRROR,
     50     SHR_BPROF_BCM_TX,
     51     SHR_BPROF_BCM_RX,
     52     SHR_BPROF_BCM_L3,
     53     SHR_BPROF_BCM_IPMC,
     54     SHR_BPROF_BCM_MPLS,
     55     SHR_BPROF_BCM_MIM,
     56     SHR_BPROF_BCM_WLAN,
     57     SHR_BPROF_BCM_PROXY,
     58     SHR_BPROF_BCM_SUBPORT,
     59     SHR_BPROF_BCM_QOS,
     60     SHR_BPROF_BCM_TRILL,
     61     SHR_BPROF_BCM_NIV,
     62     SHR_BPROF_BCM_L2GRE,
     63     SHR_BPROF_BCM_VXLAN,
     64     SHR_BPROF_BCM_EXTENDER,
     65     SHR_BPROF_BCM_MULTICAST,
     66     SHR_BPROF_BCM_AUTH,
     67     SHR_BPROF_BCM_REGEX,
     68     SHR_BPROF_BCM_TIME,
     69     SHR_BPROF_BCM_OAM,
     70     SHR_BPROF_BCM_FAILOVER,
     71     SHR_BPROF_BCM_CES,
     72     SHR_BPROF_BCM_PTP,
     73     SHR_BPROF_BCM_BFD,
     74     SHR_BPROF_BCM_GLB_METER,
     75     SHR_BPROF_BCM_FCOE,
     76     SHR_BPROF_BCM_UDF,
     77     SHR_BPROF_BCM_SAT,
     78     SHR_BPROF_BCM_RANGE,
     79     SHR_BPROF_BCM_SWITCH,
     80     SHR_BPROF_BCM_FLOW,
     81     SHR_BPROF_BCM_TSN,
     82 #ifdef SW_AUTONEG_SUPPORT    
     83     SHR_BPROF_BCM_SW_AN,
     84 #endif    
     85     SHR_BPROF_BCM_XFLOW_MACSEC,
     86     SHR_BPROF_BCM_FT,
     87     SHR_BPROF_BCM_GDPLL,
     88     SHR_BPROF_BCM_IFA,
     89     SHR_BPROF_BCM_COLLECTOR,
     90     SHR_BPROF_BCM_TELEMETRY,
     91     SHR_BPROF_BCM_LATENCY_MONITOR,
     92     SHR_BPROF_BCM_INT,
     93     SHR_BPROF_BCM_SUM,
     94     SHR_BPROF_BCM_HASH,
     95     SHR_BPROF_STATS_MAX
     96 } shr_bprof_type_t;
     97 
     98 char * shr_bprof_stats_name(int dispname);
     99 void shr_bprof_stats_time_init(void);
    100 void shr_bprof_stats_time_end(void);
    101 sal_usecs_t shr_bprof_stats_time_taken(void);
    102 void shr_bprof_stats_timer_start(int op);
    103 void shr_bprof_stats_timer_stop(int op);
    104 int shr_bprof_stats_get(int idx, shr_bprof_stats_entry_t *bprof_stats);
    105 
    106 #ifdef BCM_BPROF_STATS
    107 #define SHR_BPROF_STATS_DECL  volatile int _once
    108 
    109 #define SHR_BPROF_STATS_TIME(stat)            \
    110     shr_bprof_stats_timer_start(stat);        \
    111     for (_once = 0; _once == 0; shr_bprof_stats_timer_stop(stat), _once = 1)
    112 #else
    113 #define SHR_BPROF_STATS_DECL
    114 #define SHR_BPROF_STATS_TIME(stat)
    115 #endif /* BCM_BPROF_STATS */
    116 #endif /*_SHR_BPROF_H */