blob: 37251502e2ff0f5b960a63c3f2883d342e6fabd3 [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()
35 unsigned int wake_cache; // active fd_cache prevented poll() from sleeping
36 unsigned int wake_tasks; // active tasks prevented poll() from sleeping
37 unsigned int wake_signal; // pending signal prevented poll() from sleeping
38 unsigned int poll_exp; // number of times poll() sees an expired timeout (includes wake_*)
39 unsigned int poll_drop; // poller dropped a dead FD from the update list
40 unsigned int poll_dead; // poller woke up with a dead FD
41 unsigned int poll_skip; // poller skipped another thread's FD
Willy Tarreau609aad92018-11-22 08:31:09 +010042 unsigned int fd_lock; // fd cache skipped a locked FD
Willy Tarreau609aad92018-11-22 08:31:09 +010043 unsigned int conn_dead; // conn_fd_handler woke up on an FD indicating a dead connection
44 unsigned int stream; // calls to process_stream()
Willy Tarreau394c9b42019-05-27 06:59:14 +020045 unsigned int ctxsw; // total number of context switches
46 unsigned int tasksw; // total number of task switches
Willy Tarreau609aad92018-11-22 08:31:09 +010047 unsigned int empty_rq; // calls to process_runnable_tasks() with nothing for the thread
48 unsigned int long_rq; // process_runnable_tasks() left with tasks in the run queue
49 unsigned int cpust_total; // sum of half-ms stolen per thread
Willy Tarreaubaba82f2018-11-22 08:42:42 +010050 /* one cache line */
Willy Tarreau609aad92018-11-22 08:31:09 +010051 struct freq_ctr cpust_1s; // avg amount of half-ms stolen over last second
52 struct freq_ctr_period cpust_15s; // avg amount of half-ms stolen over last 15s
Willy Tarreaubaba82f2018-11-22 08:42:42 +010053 unsigned int avg_loop_us; // average run time per loop over last 1024 runs
Willy Tarreau64a9c052019-04-12 15:27:17 +020054 unsigned int accepted; // accepted incoming connections
Willy Tarreau8a034082019-02-27 10:45:55 +010055 unsigned int accq_pushed; // accept queue connections pushed
56 unsigned int accq_full; // accept queue connection not pushed because full
Willy Tarreaua8b2ce02019-05-28 17:04:16 +020057 unsigned int pool_fail; // failed a pool allocation
58 unsigned int buf_wait; // waited on a buffer allocation
Willy Tarreaud6a78502019-05-27 07:03:38 +020059#if defined(DEBUG_DEV)
60 /* keep these ones at the end */
61 unsigned int ctr0; // general purposee debug counter
62 unsigned int ctr1; // general purposee debug counter
63 unsigned int ctr2; // general purposee debug counter
64#endif
Willy Tarreau609aad92018-11-22 08:31:09 +010065 char __pad[0]; // unused except to check remaining room
66 char __end[0] __attribute__((aligned(64))); // align size to 64.
67};
68
69#endif /* _TYPES_ACTIVITY_H */
70
71/*
72 * Local variables:
73 * c-indent-level: 8
74 * c-basic-offset: 8
75 * End:
76 */