xref: /wlan-driver/qca-wifi-host-cmn/qdf/linux/src/i_qdf_perf.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2016 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name /**
20*5113495bSYour Name  * DOC: i_qdf_perf
21*5113495bSYour Name  * This file provides OS dependent perf API's.
22*5113495bSYour Name  */
23*5113495bSYour Name 
24*5113495bSYour Name #ifndef _I_QDF_PERF_H
25*5113495bSYour Name #define _I_QDF_PERF_H
26*5113495bSYour Name 
27*5113495bSYour Name #ifdef QCA_PERF_PROFILING
28*5113495bSYour Name 
29*5113495bSYour Name #if (QCA_MIPS74K_PERF_PROFILING || QCA_MIPS24KK_PERF_PROFILING)
30*5113495bSYour Name #include <qdf_mips_perf_pvt.h>
31*5113495bSYour Name #endif
32*5113495bSYour Name 
33*5113495bSYour Name /* #defines required for structures */
34*5113495bSYour Name #define MAX_SAMPLES_SHIFT   5   /* change this only*/
35*5113495bSYour Name #define MAX_SAMPLES         (1 << MAX_SAMPLES_SHIFT)
36*5113495bSYour Name #define INC_SAMPLES(x)      ((x + 1) & (MAX_SAMPLES - 1))
37*5113495bSYour Name #define MAX_SAMPLE_SZ       (sizeof(uint32_t) * MAX_SAMPLES)
38*5113495bSYour Name #define PER_SAMPLE_SZ       sizeof(uint32_t)
39*5113495bSYour Name 
40*5113495bSYour Name /**
41*5113495bSYour Name  * typedef qdf_perf_entry_t - performance entry
42*5113495bSYour Name  * @list: pointer to next
43*5113495bSYour Name  * @child: pointer tochild
44*5113495bSYour Name  * @parent: pointer to top
45*5113495bSYour Name  * @type: perf cntr
46*5113495bSYour Name  * @name: string
47*5113495bSYour Name  * @proc: pointer to proc entry
48*5113495bSYour Name  * @start_tsc: array at start tsc
49*5113495bSYour Name  * @end_tsc: array at ent tsc
50*5113495bSYour Name  * @samples: array of samples
51*5113495bSYour Name  * @sample_idx: sample index
52*5113495bSYour Name  * @lock_irq: lock irq
53*5113495bSYour Name  */
54*5113495bSYour Name typedef struct qdf_os_perf_entry {
55*5113495bSYour Name 	struct list_head        list;
56*5113495bSYour Name 	struct list_head        child;
57*5113495bSYour Name 
58*5113495bSYour Name 	struct qdf_perf_entry   *parent;
59*5113495bSYour Name 
60*5113495bSYour Name 	qdf_perf_cntr_t type;
61*5113495bSYour Name 	uint8_t *name;
62*5113495bSYour Name 
63*5113495bSYour Name 	struct proc_dir_entry   *proc;
64*5113495bSYour Name 
65*5113495bSYour Name 	uint64_t        start_tsc[MAX_SAMPLES];
66*5113495bSYour Name 	uint64_t        end_tsc[MAX_SAMPLES];
67*5113495bSYour Name 
68*5113495bSYour Name 	uint32_t        samples[MAX_SAMPLES];
69*5113495bSYour Name 	uint32_t        sample_idx;
70*5113495bSYour Name 
71*5113495bSYour Name 	spinlock_t      lock_irq;
72*5113495bSYour Name 
73*5113495bSYour Name } qdf_perf_entry_t;
74*5113495bSYour Name 
75*5113495bSYour Name /* typedefs */
76*5113495bSYour Name typedef void *__qdf_perf_id_t;
77*5113495bSYour Name 
78*5113495bSYour Name #endif /* QCA_PERF_PROFILING */
79*5113495bSYour Name #endif /* _I_QDF_PERF_H */
80