blob: 9cf4e731d044625ca4f7cad401eb4a466029b197 [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
42 unsigned int fd_skip; // fd cache skipped another thread's FD
43 unsigned int fd_lock; // fd cache skipped a locked FD
44 unsigned int fd_del; // fd cache detected a deleted FD
45 unsigned int conn_dead; // conn_fd_handler woke up on an FD indicating a dead connection
46 unsigned int stream; // calls to process_stream()
47 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 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 Tarreau609aad92018-11-22 08:31:09 +010056 char __pad[0]; // unused except to check remaining room
57 char __end[0] __attribute__((aligned(64))); // align size to 64.
58};
59
60#endif /* _TYPES_ACTIVITY_H */
61
62/*
63 * Local variables:
64 * c-indent-level: 8
65 * c-basic-offset: 8
66 * End:
67 */