1 /*
2  *  OpenVPN -- An application to securely tunnel IP networks
3  *             over a single TCP/UDP port, with support for SSL/TLS-based
4  *             session authentication and key exchange,
5  *             packet encryption, packet authentication, and
6  *             packet compression.
7  *
8  *  Copyright (C) 2002-2018 OpenVPN Inc <sales@openvpn.net>
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License version 2
12  *  as published by the Free Software Foundation.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License along
20  *  with this program; if not, write to the Free Software Foundation, Inc.,
21  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 /*
25  * The interval_ routines are designed to optimize the calling of a routine
26  * (normally tls_multi_process()) which can be called less frequently
27  * between triggers.
28  */
29 
30 #ifndef PERF_H
31 #define PERF_H
32 
33 /*#define ENABLE_PERFORMANCE_METRICS*/
34 
35 /*
36  * Metrics
37  */
38 #define PERF_BIO_READ_PLAINTEXT     0
39 #define PERF_BIO_WRITE_PLAINTEXT    1
40 #define PERF_BIO_READ_CIPHERTEXT    2
41 #define PERF_BIO_WRITE_CIPHERTEXT   3
42 #define PERF_TLS_MULTI_PROCESS      4
43 #define PERF_IO_WAIT                5
44 #define PERF_EVENT_LOOP             6
45 #define PERF_MULTI_CREATE_INSTANCE  7
46 #define PERF_MULTI_CLOSE_INSTANCE   8
47 #define PERF_MULTI_SHOW_STATS       9
48 #define PERF_MULTI_BCAST            10
49 #define PERF_MULTI_MCAST            11
50 #define PERF_SCRIPT                 12
51 #define PERF_READ_IN_LINK           13
52 #define PERF_PROC_IN_LINK           14
53 #define PERF_READ_IN_TUN            15
54 #define PERF_PROC_IN_TUN            16
55 #define PERF_PROC_OUT_LINK          17
56 #define PERF_PROC_OUT_TUN           18
57 #define PERF_PROC_OUT_TUN_MTCP      19
58 #define PERF_N                      20
59 
60 #ifdef ENABLE_PERFORMANCE_METRICS
61 
62 #include "basic.h"
63 
64 /*
65  * Stack size
66  */
67 #define STACK_N               64
68 
69 void perf_push(int type);
70 
71 void perf_pop(void);
72 
73 void perf_output_results(void);
74 
75 #else  /* ifdef ENABLE_PERFORMANCE_METRICS */
76 
77 static inline void
perf_push(int type)78 perf_push(int type)
79 {
80 }
81 static inline void
perf_pop(void)82 perf_pop(void)
83 {
84 }
85 static inline void
perf_output_results(void)86 perf_output_results(void)
87 {
88 }
89 
90 #endif /* ifdef ENABLE_PERFORMANCE_METRICS */
91 
92 #endif /* ifndef PERF_H */
93