123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- /*
- * Copyright (C) 2019 Weber Yann
- *
- * This file is part of PyFCGI.
- *
- * PyFCGI is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * PyFCGI is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with PyFCGI. If not, see <http://www.gnu.org/licenses/>.
- */
- /**@file stats.h
- * @ingroup monitoring */
- #ifndef _STATS__H___
- #define _STATS__H___
- #include "config.h"
-
- #include <fcgiapp.h>
-
- #include <signal.h>
- #include <string.h>
-
- typedef struct pyfcgi_stats_s pyfcgi_stats_t;
-
- #include "conf.h"
- #include "logger.h"
-
- struct pyfcgi_stats_s
- {
- /**@brief Request per seconds on 15 minutes */
- int reqs[900];
- /**@brief Current request index */
- int cur_req;
-
- /**@brief Repeating 1s timer sending SIGALRM */
- timer_t timerid;
-
- /**@brief Old SIGALRM handler */
- struct sigaction oldact;
- };
-
- /**@brief Starts collecting statistics
- *
- * Set an handler for SIGALRM and set a repeating alarm each seconds
- * @warning designed to be called from monitor server process
- * @return -1 on error else 0
- */
- int pyfcgi_stats_init();
-
- /**@brief SIGALRM signal handler
- * @param int signum
- */
- void pyfcgi_stats_collector(int);
-
- #endif
|