X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/a77998f78db2adf5b6760deb8b9321543ad6e59a..7a0ffbb5910bd782ef569b63ce665659e3564e72:/keydctl.c diff --git a/keydctl.c b/keydctl.c index 96af7d2..c66ce28 100644 --- a/keydctl.c +++ b/keydctl.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -138,10 +139,37 @@ static void keyd_close(void) static void keyd_status(void) { uint32_t reply; + struct keyd_stats stats; keyd_do_command(KEYD_CMD_VERSION, &reply, sizeof(reply)); printf("Using keyd protocol version %d.\n", reply); + keyd_do_command(KEYD_CMD_STATS, &stats, sizeof(stats)); + printf("keyd running since %s", ctime(&stats.started)); + printf("%d client connections received\n", stats.connects); + + printf("Command statistics:\n"); + printf(" Version: %d\n", + stats.command_stats[KEYD_CMD_VERSION]); + printf(" Get key: %d\n", stats.command_stats[KEYD_CMD_GET]); + printf(" Store key: %d\n", + stats.command_stats[KEYD_CMD_STORE]); + printf(" Delete key: %d\n", + stats.command_stats[KEYD_CMD_DELETE]); + printf(" Search key: %d\n", + stats.command_stats[KEYD_CMD_GETTEXT]); + printf(" Get full keyid: %d\n", + stats.command_stats[KEYD_CMD_GETFULLKEYID]); + printf(" Iterate all keys: %d\n", + stats.command_stats[KEYD_CMD_KEYITER]); + printf(" Close: %d\n", + stats.command_stats[KEYD_CMD_CLOSE]); + printf(" Quit: %d\n", stats.command_stats[KEYD_CMD_QUIT]); + printf(" Get statistics: %d\n", + stats.command_stats[KEYD_CMD_STATS]); + printf(" Unknown: %d\n", + stats.command_stats[KEYD_CMD_UNKNOWN]); + return; }