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-2010 OpenVPN Technologies, 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
20 *  along with this program (see the file COPYING included with this
21 *  distribution); if not, write to the Free Software Foundation, Inc.,
22 *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 */
24
25/*
26 * The interval_ routines are designed to optimize the calling of a routine
27 * (normally tls_multi_process()) which can be called less frequently
28 * between triggers.
29 */
30
31#ifndef PERF_H
32#define PERF_H
33
34/*#define ENABLE_PERFORMANCE_METRICS*/
35
36/*
37 * Metrics
38 */
39#define PERF_BIO_READ_PLAINTEXT     0
40#define PERF_BIO_WRITE_PLAINTEXT    1
41#define PERF_BIO_READ_CIPHERTEXT    2
42#define PERF_BIO_WRITE_CIPHERTEXT   3
43#define PERF_TLS_MULTI_PROCESS      4
44#define PERF_IO_WAIT                5
45#define PERF_EVENT_LOOP             6
46#define PERF_MULTI_CREATE_INSTANCE  7
47#define PERF_MULTI_CLOSE_INSTANCE   8
48#define PERF_MULTI_SHOW_STATS       9
49#define PERF_MULTI_BCAST            10
50#define PERF_MULTI_MCAST            11
51#define PERF_SCRIPT                 12
52#define PERF_READ_IN_LINK           13
53#define PERF_PROC_IN_LINK           14
54#define PERF_READ_IN_TUN            15
55#define PERF_PROC_IN_TUN            16
56#define PERF_PROC_OUT_LINK          17
57#define PERF_PROC_OUT_TUN           18
58#define PERF_PROC_OUT_TUN_MTCP      19
59#define PERF_N                      20
60
61#ifdef ENABLE_PERFORMANCE_METRICS
62
63#include "basic.h"
64
65/*
66 * Stack size
67 */
68#define STACK_N               64
69
70void perf_push (int type);
71void perf_pop (void);
72void perf_output_results (void);
73
74#else
75
76static inline void perf_push (int type) {}
77static inline void perf_pop (void) {}
78static inline void perf_output_results (void) {}
79
80#endif
81
82#endif
83