blob: 01e484facd2745b804247db3690b5e916b222c3a [file] [log] [blame]
Willy Tarreau609aad92018-11-22 08:31:09 +01001/*
2 * include/types/activity.h
3 * This file contains structure declarations for activity measurements.
4 *
5 * Copyright (C) 2000-2018 Willy Tarreau - w@1wt.eu
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, version 2.1
10 * exclusively.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef _TYPES_ACTIVITY_H
23#define _TYPES_ACTIVITY_H
24
25#include <common/config.h>
26#include <types/freq_ctr.h>
27
28/* per-thread activity reports. It's important that it's aligned on cache lines
29 * because some elements will be updated very often. Most counters are OK on
30 * 32-bit since this will be used during debugging sessions for troubleshooting
31 * in iterative mode.
32 */
33struct activity {
34 unsigned int loops; // complete loops in run_poll_loop()
Willy Tarreau609aad92018-11-22 08:31:09 +010035 unsigned int wake_tasks; // active tasks prevented poll() from sleeping
36 unsigned int wake_signal; // pending signal prevented poll() from sleeping
37 unsigned int poll_exp; // number of times poll() sees an expired timeout (includes wake_*)
38 unsigned int poll_drop; // poller dropped a dead FD from the update list
39 unsigned int poll_dead; // poller woke up with a dead FD
40 unsigned int poll_skip; // poller skipped another thread's FD
Willy Tarreau609aad92018-11-22 08:31:09 +010041 unsigned int fd_lock; // fd cache skipped a locked FD
Willy Tarreau609aad92018-11-22 08:31:09 +010042 unsigned int conn_dead; // conn_fd_handler woke up on an FD indicating a dead connection
43 unsigned int stream; // calls to process_stream()
Willy Tarreau394c9b42019-05-27 06:59:14 +020044 unsigned int ctxsw; // total number of context switches
45 unsigned int tasksw; // total number of task switches
Willy Tarreau609aad92018-11-22 08:31:09 +010046 unsigned int empty_rq; // calls to process_runnable_tasks() with nothing for the thread
47 unsigned int long_rq; // process_runnable_tasks() left with tasks in the run queue
48 unsigned int cpust_total; // sum of half-ms stolen per thread
Willy Tarreaubaba82f2018-11-22 08:42:42 +010049 /* one cache line */
Willy Tarreau609aad92018-11-22 08:31:09 +010050 struct freq_ctr cpust_1s; // avg amount of half-ms stolen over last second
51 struct freq_ctr_period cpust_15s; // avg amount of half-ms stolen over last 15s
Willy Tarreaubaba82f2018-11-22 08:42:42 +010052 unsigned int avg_loop_us; // average run time per loop over last 1024 runs
Willy Tarreau64a9c052019-04-12 15:27:17 +020053 unsigned int accepted; // accepted incoming connections
Willy Tarreau8a034082019-02-27 10:45:55 +010054 unsigned int accq_pushed; // accept queue connections pushed
55 unsigned int accq_full; // accept queue connection not pushed because full
Willy Tarreaua8b2ce02019-05-28 17:04:16 +020056 unsigned int pool_fail; // failed a pool allocation
57 unsigned int buf_wait; // waited on a buffer allocation
Willy Tarreaud6a78502019-05-27 07:03:38 +020058#if defined(DEBUG_DEV)
59 /* keep these ones at the end */
60 unsigned int ctr0; // general purposee debug counter
61 unsigned int ctr1; // general purposee debug counter
62 unsigned int ctr2; // general purposee debug counter
63#endif
Willy Tarreau609aad92018-11-22 08:31:09 +010064 char __pad[0]; // unused except to check remaining room
65 char __end[0] __attribute__((aligned(64))); // align size to 64.
66};
67
68#endif /* _TYPES_ACTIVITY_H */
69
70/*
71 * Local variables:
72 * c-indent-level: 8
73 * c-basic-offset: 8
74 * End:
75 */