[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20398 - gnunet/src/arm
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20398 - gnunet/src/arm |
Date: |
Fri, 9 Mar 2012 12:39:53 +0100 |
Author: grothoff
Date: 2012-03-09 12:39:53 +0100 (Fri, 09 Mar 2012)
New Revision: 20398
Modified:
gnunet/src/arm/gnunet-service-arm.c
Log:
adding code to measure and report shutdown time for services to
gnunet-service-arm at INFO level logging
Modified: gnunet/src/arm/gnunet-service-arm.c
===================================================================
--- gnunet/src/arm/gnunet-service-arm.c 2012-03-09 11:39:50 UTC (rev 20397)
+++ gnunet/src/arm/gnunet-service-arm.c 2012-03-09 11:39:53 UTC (rev 20398)
@@ -146,6 +146,12 @@
struct GNUNET_TIME_Absolute restart_at;
/**
+ * Time we asked the service to shut down (used to calculate time it took
+ * the service to terminate).
+ */
+ struct GNUNET_TIME_Absolute killed_at;
+
+ /**
* Is this service to be started by default (or did a client tell us
explicitly
* to start it)? GNUNET_NO if the service is started only upon 'accept' on a
* listen socket or possibly explicitly by a client changing the value.
@@ -694,6 +700,7 @@
"Sending kill signal to service `%s', waiting for process to
die.\n",
servicename);
#endif
+ sl->killed_at = GNUNET_TIME_absolute_get ();
if (0 != GNUNET_OS_process_kill (sl->proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
sl->killing_client = client;
@@ -824,6 +831,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stopping service `%s'\n",
pos->name);
+ pos->killed_at = GNUNET_TIME_absolute_get ();
if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
}
@@ -955,11 +963,11 @@
next = pos->next;
if (pos->proc == NULL)
- {
- if (GNUNET_YES == in_shutdown)
- free_service (pos);
- continue;
- }
+ {
+ if (GNUNET_YES == in_shutdown)
+ free_service (pos);
+ continue;
+ }
if ((GNUNET_SYSERR ==
(ret =
GNUNET_OS_process_status (pos->proc, &statusType, &statusCode)))
@@ -967,20 +975,27 @@
|| (statusType == GNUNET_OS_PROCESS_RUNNING)))
continue;
if (statusType == GNUNET_OS_PROCESS_EXITED)
- {
- statstr = _( /* process termination method */ "exit");
- statcode = statusCode;
- }
+ {
+ statstr = _( /* process termination method */ "exit");
+ statcode = statusCode;
+ }
else if (statusType == GNUNET_OS_PROCESS_SIGNALED)
- {
- statstr = _( /* process termination method */ "signal");
- statcode = statusCode;
- }
+ {
+ statstr = _( /* process termination method */ "signal");
+ statcode = statusCode;
+ }
else
- {
- statstr = _( /* process termination method */ "unknown");
- statcode = 0;
- }
+ {
+ statstr = _( /* process termination method */ "unknown");
+ statcode = 0;
+ }
+ if (0 != pos->killed_at.abs_value)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Service `%s' took %llu ms to terminate\n"),
+ pos->name,
+ GNUNET_TIME_absolute_get_duration
(pos->killed_at).rel_value);
+ }
GNUNET_OS_process_close (pos->proc);
pos->proc = NULL;
if (NULL != pos->killing_client)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20398 - gnunet/src/arm,
gnunet <=