Mercurial > hg > freeDiameter
annotate extensions/dbg_monitor/dbg_monitor.c @ 1554:566bb46cc73f
Updated copyright information
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Tue, 06 Oct 2020 21:34:53 +0800 |
parents | 3cbe458fbfa9 |
children |
rev | line source |
---|---|
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 * Software License Agreement (BSD License) * |
740
4a9f08d6b6ba
Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 * * |
1554
566bb46cc73f
Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1405
diff
changeset
|
5 * Copyright (c) 2020, WIDE Project and NICT * |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 * All rights reserved. * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 * * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
8 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 * permitted provided that the following conditions are met: * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 * * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 * * Redistributions of source code must retain the above * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 * copyright notice, this list of conditions and the * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 * following disclaimer. * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 * * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 * * Redistributions in binary form must reproduce the above * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 * copyright notice, this list of conditions and the * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 * following disclaimer in the documentation and/or other * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 * materials provided with the distribution. * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 * * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 * * Neither the name of the WIDE Project or NICT nor the * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 * names of its contributors may be used to endorse or * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 * promote products derived from this software without * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 * specific prior written permission of WIDE Project and * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 * NICT. * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 * * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 *********************************************************************************************************/ |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 /* Monitoring extension: |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 - periodically display queues and peers information |
97
00e36de5dcc4
Resolved signal conflict
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
25
diff
changeset
|
38 - upon SIGUSR2, display additional debug information |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
39 */ |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
40 |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
41 #include <freeDiameter/extension.h> |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
42 #include <signal.h> |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
43 |
97
00e36de5dcc4
Resolved signal conflict
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
25
diff
changeset
|
44 #ifndef MONITOR_SIGNAL |
00e36de5dcc4
Resolved signal conflict
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
25
diff
changeset
|
45 #define MONITOR_SIGNAL SIGUSR2 |
00e36de5dcc4
Resolved signal conflict
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
25
diff
changeset
|
46 #endif /* MONITOR_SIGNAL */ |
00e36de5dcc4
Resolved signal conflict
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
25
diff
changeset
|
47 |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
48 static int monitor_main(char * conffile); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
49 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
97
diff
changeset
|
50 EXTENSION_ENTRY("dbg_monitor", monitor_main); |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
52 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
53 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
54 /* Display information about a queue */ |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
55 static void display_info(char * queue_desc, char * peer, int current_count, int limit_count, int highest_count, long long total_count, |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
56 struct timespec * total, struct timespec * blocking, struct timespec * last) |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
57 { |
1083
d0017c5dde61
Fix display of the time in stats
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1075
diff
changeset
|
58 long long us = (total->tv_sec * 1000000) + (total->tv_nsec / 1000); |
1075
54d1cb00331a
Use float type to solve /0 issue
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1072
diff
changeset
|
59 long double throughput = (long double)total_count * 1000000; |
1083
d0017c5dde61
Fix display of the time in stats
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1075
diff
changeset
|
60 throughput /= us; |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
61 if (peer) { |
1075
54d1cb00331a
Use float type to solve /0 issue
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1072
diff
changeset
|
62 TRACE_DEBUG(INFO, "'%s'@'%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%.2LFitems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
63 queue_desc, peer, current_count, limit_count, highest_count, |
1083
d0017c5dde61
Fix display of the time in stats
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1075
diff
changeset
|
64 total_count, total->tv_sec, total->tv_nsec/1000, throughput, |
d0017c5dde61
Fix display of the time in stats
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1075
diff
changeset
|
65 blocking->tv_sec, blocking->tv_nsec/1000, last->tv_sec, last->tv_nsec/1000); |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
66 } else { |
1075
54d1cb00331a
Use float type to solve /0 issue
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1072
diff
changeset
|
67 TRACE_DEBUG(INFO, "Global '%s': cur:%d/%d, h:%d, T:%lld in %ld.%06lds (%.2LFitems/s), blocked:%ld.%06lds, last processing:%ld.%06lds", |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
68 queue_desc, current_count, limit_count, highest_count, |
1083
d0017c5dde61
Fix display of the time in stats
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1075
diff
changeset
|
69 total_count, total->tv_sec, total->tv_nsec/1000, throughput, |
d0017c5dde61
Fix display of the time in stats
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1075
diff
changeset
|
70 blocking->tv_sec, blocking->tv_nsec/1000, last->tv_sec, last->tv_nsec/1000); |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
71 } |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
72 } |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
73 |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
74 /* Thread to display periodical debug information */ |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
75 static pthread_t thr; |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
76 static void * mn_thr(void * arg) |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
77 { |
1405 | 78 #ifdef DEBUG |
195
73f73ac55725
Replace countdown with a time counter
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
185
diff
changeset
|
79 int i = 0; |
1405 | 80 #endif |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
81 fd_log_threadname("Monitor thread"); |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
82 char * buf = NULL; |
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
83 size_t len; |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
84 |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
85 /* Loop */ |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
86 while (1) { |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
87 int current_count, limit_count, highest_count; |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
88 long long total_count; |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
89 struct timespec total, blocking, last; |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
90 struct fd_list * li; |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
91 |
11
6576ef5e01eb
Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
10
diff
changeset
|
92 #ifdef DEBUG |
195
73f73ac55725
Replace countdown with a time counter
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
185
diff
changeset
|
93 for (i++; i % 30; i++) { |
974
2091bf698fb1
Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents:
740
diff
changeset
|
94 fd_log_debug("[dbg_monitor] %ih%*im%*is", i/3600, 2, (i/60) % 60 , 2, i%60); /* This makes it easier to detect inactivity periods in the log file */ |
176
80eb9ba234c4
Added regular traces
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
120
diff
changeset
|
95 sleep(1); |
80eb9ba234c4
Added regular traces
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
120
diff
changeset
|
96 } |
11
6576ef5e01eb
Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
10
diff
changeset
|
97 #else /* DEBUG */ |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
98 sleep(3599); /* 1 hour */ |
11
6576ef5e01eb
Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
10
diff
changeset
|
99 #endif /* DEBUG */ |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
100 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping queues statistics"); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
101 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
102 CHECK_FCT_DO( fd_stat_getstats(STAT_G_LOCAL, NULL, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
103 display_info("Local delivery", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
104 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
105 CHECK_FCT_DO( fd_stat_getstats(STAT_G_INCOMING, NULL, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
106 display_info("Total received", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
107 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
108 CHECK_FCT_DO( fd_stat_getstats(STAT_G_OUTGOING, NULL, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
109 display_info("Total sending", NULL, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
110 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
111 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
112 CHECK_FCT_DO( pthread_rwlock_rdlock(&fd_g_peers_rw), /* continue */ ); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
113 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
114 for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) { |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
115 struct peer_hdr * p = (struct peer_hdr *)li->o; |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
116 |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
117 TRACE_DEBUG(INFO, "%s", fd_peer_dump(&buf, &len, NULL, p, 1)); |
1072
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
118 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
119 CHECK_FCT_DO( fd_stat_getstats(STAT_P_PSM, p, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
120 display_info("Events, incl. recept", p->info.pi_diamid, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
121 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
122 CHECK_FCT_DO( fd_stat_getstats(STAT_P_TOSEND, p, ¤t_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), ); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
123 display_info("Outgoing", p->info.pi_diamid, current_count, limit_count, highest_count, total_count, &total, &blocking, &last); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
124 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
125 } |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
126 |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
127 CHECK_FCT_DO( pthread_rwlock_unlock(&fd_g_peers_rw), /* continue */ ); |
9a7d3ecbb44b
Update dbg_monitor to use the new function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
128 |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
129 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping servers information"); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
130 TRACE_DEBUG(INFO, "%s", fd_servers_dump(&buf, &len, NULL, 1)); |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
131 |
185 | 132 sleep(1); |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
133 } |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
134 |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
135 free(buf); |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
136 return NULL; |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
137 } |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
138 |
240
42e971738a37
Use centralized signal management
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
202
diff
changeset
|
139 /* Function called on receipt of MONITOR_SIGNAL */ |
658
f198d16fa7f4
Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
258
diff
changeset
|
140 static void got_sig() |
240
42e971738a37
Use centralized signal management
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
202
diff
changeset
|
141 { |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
142 char * buf = NULL; |
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
143 size_t len; |
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
144 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping config information"); |
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
145 TRACE_DEBUG(INFO, "%s", fd_conf_dump(&buf, &len, NULL)); |
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
146 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping extensions information"); |
1220
cec3e9b579e1
Cleanup parameter that has become useless
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
147 TRACE_DEBUG(INFO, "%s", fd_ext_dump(&buf, &len, NULL)); |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
148 TRACE_DEBUG(INFO, "[dbg_monitor] Dumping dictionary information"); |
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
149 TRACE_DEBUG(INFO, "%s", fd_dict_dump(&buf, &len, NULL, fd_g_config->cnf_dict)); |
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1083
diff
changeset
|
150 free(buf); |
240
42e971738a37
Use centralized signal management
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
202
diff
changeset
|
151 } |
42e971738a37
Use centralized signal management
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
202
diff
changeset
|
152 |
42e971738a37
Use centralized signal management
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
202
diff
changeset
|
153 /* Entry point */ |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
154 static int monitor_main(char * conffile) |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
155 { |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
156 TRACE_ENTRY("%p", conffile); |
240
42e971738a37
Use centralized signal management
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
202
diff
changeset
|
157 |
42e971738a37
Use centralized signal management
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
202
diff
changeset
|
158 /* Catch signal SIGUSR1 */ |
658
f198d16fa7f4
Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
258
diff
changeset
|
159 CHECK_FCT( fd_event_trig_regcb(MONITOR_SIGNAL, "dbg_monitor", got_sig)); |
240
42e971738a37
Use centralized signal management
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
202
diff
changeset
|
160 |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
161 CHECK_POSIX( pthread_create( &thr, NULL, mn_thr, NULL ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
162 return 0; |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
163 } |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
164 |
240
42e971738a37
Use centralized signal management
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
202
diff
changeset
|
165 /* Cleanup */ |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
166 void fd_ext_fini(void) |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
167 { |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
168 TRACE_ENTRY(); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
169 CHECK_FCT_DO( fd_thr_term(&thr), /* continue */ ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
170 return ; |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
171 } |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
172 |