Expose maxscale starttime.
Maxinfo needs access to the time MaxScale was started. Now exposed in a way similar to the uptime.
This commit is contained in:
parent
59edee26c6
commit
51755aae0c
@ -1291,7 +1291,7 @@ int main(int argc, char **argv)
|
||||
*maxlog_enabled = 1;
|
||||
*log_to_shm = 0;
|
||||
|
||||
maxscale_reset_uptime();
|
||||
maxscale_reset_starttime();
|
||||
|
||||
sigemptyset(&sigpipe_mask);
|
||||
sigaddset(&sigpipe_mask, SIGPIPE);
|
||||
|
@ -20,14 +20,22 @@
|
||||
#include <maxscale.h>
|
||||
#include <time.h>
|
||||
|
||||
static time_t maxscale_started;
|
||||
static time_t started;
|
||||
|
||||
/**
|
||||
* Reset the start time from which the uptime is calculated.
|
||||
*/
|
||||
void maxscale_reset_uptime(void)
|
||||
void maxscale_reset_starttime(void)
|
||||
{
|
||||
maxscale_started = time(0);
|
||||
started = time(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the time when MaxScale was started.
|
||||
*/
|
||||
time_t maxscale_started(void)
|
||||
{
|
||||
return started;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -37,5 +45,5 @@ void maxscale_reset_uptime(void)
|
||||
*/
|
||||
int maxscale_uptime()
|
||||
{
|
||||
return time(0) - maxscale_started;
|
||||
return time(0) - started;
|
||||
}
|
||||
|
@ -32,6 +32,9 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
/* Exit status for MaxScale */
|
||||
#define MAXSCALE_SHUTDOWN 0 /* Good shutdown */
|
||||
#define MAXSCALE_BADCONFIG 1 /* Configuration fiel error */
|
||||
@ -41,7 +44,8 @@
|
||||
#define MAXSCALE_BADARG 5 /* Bad command line argument */
|
||||
#define MAXSCALE_INTERNALERROR 6 /* Internal error, see error log */
|
||||
|
||||
void maxscale_reset_uptime(void);
|
||||
void maxscale_reset_starttime(void);
|
||||
time_t maxscale_started(void);
|
||||
int maxscale_uptime(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user