diff options
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | po/POTFILES.in | 3 | ||||
-rw-r--r-- | src/arm/arm.conf.in | 2 | ||||
-rw-r--r-- | src/arm/gnunet-service-arm.c | 115 |
4 files changed, 117 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index 2d9fe0b06..baf7a5517 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -375,7 +375,7 @@ then | |||
375 | bluetooth=1 | 375 | bluetooth=1 |
376 | fi | 376 | fi |
377 | AM_CONDITIONAL(HAVE_LIBBLUETOOTH, [test "$bluetooth" = 1]) | 377 | AM_CONDITIONAL(HAVE_LIBBLUETOOTH, [test "$bluetooth" = 1]) |
378 | if test "$bluetooth" = 1 | 378 | if test "$bluetooth" = 1 |
379 | then | 379 | then |
380 | AC_DEFINE([HAVE_LIBBLUETOOTH],[1],[Have bluetooth library]) | 380 | AC_DEFINE([HAVE_LIBBLUETOOTH],[1],[Have bluetooth library]) |
381 | else | 381 | else |
@@ -781,7 +781,7 @@ postgres=false | |||
781 | AX_LIB_POSTGRESQL([]) | 781 | AX_LIB_POSTGRESQL([]) |
782 | if test "$found_postgresql" = "yes"; then | 782 | if test "$found_postgresql" = "yes"; then |
783 | CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" | 783 | CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" |
784 | AC_CHECK_HEADERS([libpq-fe.h], | 784 | AC_CHECK_HEADERS([libpq-fe.h], |
785 | postgres=true) | 785 | postgres=true) |
786 | fi | 786 | fi |
787 | 787 | ||
@@ -1002,7 +1002,7 @@ AC_FUNC_VPRINTF | |||
1002 | AC_HEADER_SYS_WAIT | 1002 | AC_HEADER_SYS_WAIT |
1003 | AC_TYPE_OFF_T | 1003 | AC_TYPE_OFF_T |
1004 | AC_TYPE_UID_T | 1004 | AC_TYPE_UID_T |
1005 | AC_CHECK_FUNCS([atoll stat64 strnlen mremap getrlimit setrlimit sysconf initgroups strndup gethostbyname2 getpeerucred getpeereid setresuid $funcstocheck getifaddrs freeifaddrs getresgid mallinfo malloc_size malloc_usable_size getrusage random srandom stat statfs statvfs]) | 1005 | AC_CHECK_FUNCS([atoll stat64 strnlen mremap getrlimit setrlimit sysconf initgroups strndup gethostbyname2 getpeerucred getpeereid setresuid $funcstocheck getifaddrs freeifaddrs getresgid mallinfo malloc_size malloc_usable_size getrusage random srandom stat statfs statvfs wait4]) |
1006 | 1006 | ||
1007 | # restore LIBS | 1007 | # restore LIBS |
1008 | LIBS=$SAVE_LIBS | 1008 | LIBS=$SAVE_LIBS |
diff --git a/po/POTFILES.in b/po/POTFILES.in index ed408ebc1..9e5cbfbe0 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -204,6 +204,8 @@ src/identity/gnunet-service-identity.c | |||
204 | src/identity/identity_api.c | 204 | src/identity/identity_api.c |
205 | src/identity/identity_api_lookup.c | 205 | src/identity/identity_api_lookup.c |
206 | src/identity/plugin_rest_identity.c | 206 | src/identity/plugin_rest_identity.c |
207 | src/identity-token/gnunet-identity-token.c | ||
208 | src/identity-token/plugin_rest_identity_token.c | ||
207 | src/multicast/gnunet-multicast.c | 209 | src/multicast/gnunet-multicast.c |
208 | src/multicast/gnunet-service-multicast.c | 210 | src/multicast/gnunet-service-multicast.c |
209 | src/multicast/multicast_api.c | 211 | src/multicast/multicast_api.c |
@@ -255,7 +257,6 @@ src/psycstore/gnunet-service-psycstore.c | |||
255 | src/psycstore/plugin_psycstore_sqlite.c | 257 | src/psycstore/plugin_psycstore_sqlite.c |
256 | src/psycstore/psycstore_api.c | 258 | src/psycstore/psycstore_api.c |
257 | src/psycstore/psyc_util_lib.c | 259 | src/psycstore/psyc_util_lib.c |
258 | src/psycstore/psyc_util_lib.c | ||
259 | src/pt/gnunet-daemon-pt.c | 260 | src/pt/gnunet-daemon-pt.c |
260 | src/regex/gnunet-daemon-regexprofiler.c | 261 | src/regex/gnunet-daemon-regexprofiler.c |
261 | src/regex/gnunet-regex-profiler.c | 262 | src/regex/gnunet-regex-profiler.c |
diff --git a/src/arm/arm.conf.in b/src/arm/arm.conf.in index 20d3e1dc0..38cf4599c 100644 --- a/src/arm/arm.conf.in +++ b/src/arm/arm.conf.in | |||
@@ -41,6 +41,8 @@ GLOBAL_PREFIX = @MONKEYPREFIX@ | |||
41 | # | 41 | # |
42 | # USER_ONLY = YES | 42 | # USER_ONLY = YES |
43 | 43 | ||
44 | # File where we should log per-service resource consumption on exit. | ||
45 | # RESOURCE_DIAGNOSTICS = resource.log | ||
44 | 46 | ||
45 | 47 | ||
46 | # Name of the user that will be used to provide the service | 48 | # Name of the user that will be used to provide the service |
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index a411546d7..b8cda5945 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -29,6 +29,19 @@ | |||
29 | #include "gnunet_protocols.h" | 29 | #include "gnunet_protocols.h" |
30 | #include "arm.h" | 30 | #include "arm.h" |
31 | 31 | ||
32 | #if HAVE_WAIT4 | ||
33 | /** | ||
34 | * Name of the file for writing resource utilization summaries to. | ||
35 | */ | ||
36 | static char *wait_filename; | ||
37 | |||
38 | /** | ||
39 | * Handle for the file for writing resource summaries. | ||
40 | */ | ||
41 | static FILE *wait_file; | ||
42 | #endif | ||
43 | |||
44 | |||
32 | /** | 45 | /** |
33 | * How many messages do we queue up at most for optional | 46 | * How many messages do we queue up at most for optional |
34 | * notifications to a client? (this can cause notifications | 47 | * notifications to a client? (this can cause notifications |
@@ -81,7 +94,7 @@ struct ServiceListeningInfo | |||
81 | /** | 94 | /** |
82 | * Task doing the accepting. | 95 | * Task doing the accepting. |
83 | */ | 96 | */ |
84 | struct GNUNET_SCHEDULER_Task * accept_task; | 97 | struct GNUNET_SCHEDULER_Task *accept_task; |
85 | 98 | ||
86 | }; | 99 | }; |
87 | 100 | ||
@@ -1193,12 +1206,76 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1193 | free_service (pos); | 1206 | free_service (pos); |
1194 | continue; | 1207 | continue; |
1195 | } | 1208 | } |
1209 | #if HAVE_WAIT4 | ||
1210 | if (NULL != wait_file) | ||
1211 | { | ||
1212 | /* need to use 'wait4()' to obtain and log performance data */ | ||
1213 | struct rusage ru; | ||
1214 | int status; | ||
1215 | pid_t pid; | ||
1216 | |||
1217 | pid = GNUNET_OS_process_get_pid (pos->proc); | ||
1218 | ret = wait4 (pid, | ||
1219 | &status, | ||
1220 | WNOHANG, | ||
1221 | &ru); | ||
1222 | if (ret <= 0) | ||
1223 | continue; /* no process done */ | ||
1224 | if (WIFEXITED (status)) | ||
1225 | { | ||
1226 | statusType = GNUNET_OS_PROCESS_EXITED; | ||
1227 | statusCode = WEXITSTATUS (status); | ||
1228 | } | ||
1229 | else if (WIFSIGNALED (status)) | ||
1230 | { | ||
1231 | statusType = GNUNET_OS_PROCESS_SIGNALED; | ||
1232 | statusCode = WTERMSIG (status); | ||
1233 | } | ||
1234 | else if (WIFSTOPPED (status)) | ||
1235 | { | ||
1236 | statusType = GNUNET_OS_PROCESS_SIGNALED; | ||
1237 | statusCode = WSTOPSIG (status); | ||
1238 | } | ||
1239 | #ifdef WIFCONTINUED | ||
1240 | else if (WIFCONTINUED (status)) | ||
1241 | { | ||
1242 | statusType = GNUNET_OS_PROCESS_RUNNING; | ||
1243 | statusCode = 0; | ||
1244 | } | ||
1245 | #endif | ||
1246 | else | ||
1247 | { | ||
1248 | statusType = GNUNET_OS_PROCESS_UNKNOWN; | ||
1249 | statusCode = 0; | ||
1250 | } | ||
1251 | if ( (GNUNET_OS_PROCESS_EXITED == statusType) || | ||
1252 | (GNUNET_OS_PROCESS_SIGNALED == statusType) ) | ||
1253 | { | ||
1254 | fprintf (wait_file, | ||
1255 | "%s(%u) %llu.%llu %llu.%llu %llu %llu %llu %llu %llu\n", | ||
1256 | pos->binary, | ||
1257 | (unsigned int) pid, | ||
1258 | (unsigned long long) ru.ru_utime.tv_sec, | ||
1259 | (unsigned long long) ru.ru_utime.tv_usec, | ||
1260 | (unsigned long long) ru.ru_stime.tv_sec, | ||
1261 | (unsigned long long) ru.ru_stime.tv_usec, | ||
1262 | (unsigned long long) ru.ru_maxrss, | ||
1263 | (unsigned long long) ru.ru_inblock, | ||
1264 | (unsigned long long) ru.ru_oublock, | ||
1265 | (unsigned long long) ru.ru_nvcsw, | ||
1266 | (unsigned long long) ru.ru_nivcsw); | ||
1267 | } | ||
1268 | } | ||
1269 | else /* continue with #else */ | ||
1270 | #else | ||
1196 | if ((GNUNET_SYSERR == | 1271 | if ((GNUNET_SYSERR == |
1197 | (ret = | 1272 | (ret = |
1198 | GNUNET_OS_process_status (pos->proc, &statusType, &statusCode))) | 1273 | GNUNET_OS_process_status (pos->proc, &statusType, &statusCode))) || |
1199 | || ((ret == GNUNET_NO) || (statusType == GNUNET_OS_PROCESS_STOPPED) | 1274 | ((ret == GNUNET_NO) || |
1200 | || (statusType == GNUNET_OS_PROCESS_RUNNING))) | 1275 | (statusType == GNUNET_OS_PROCESS_STOPPED) || |
1276 | (statusType == GNUNET_OS_PROCESS_RUNNING) ) ) | ||
1201 | continue; | 1277 | continue; |
1278 | #endif | ||
1202 | if (statusType == GNUNET_OS_PROCESS_EXITED) | 1279 | if (statusType == GNUNET_OS_PROCESS_EXITED) |
1203 | { | 1280 | { |
1204 | statstr = _( /* process termination method */ "exit"); | 1281 | statstr = _( /* process termination method */ "exit"); |
@@ -1501,7 +1578,23 @@ run (void *cls, struct GNUNET_SERVER_Handle *serv, | |||
1501 | GNUNET_DISK_pipe_handle (sigpipe, | 1578 | GNUNET_DISK_pipe_handle (sigpipe, |
1502 | GNUNET_DISK_PIPE_END_READ), | 1579 | GNUNET_DISK_PIPE_END_READ), |
1503 | &maint_child_death, NULL); | 1580 | &maint_child_death, NULL); |
1504 | 1581 | #if HAVE_WAIT4 | |
1582 | if (GNUNET_OK == | ||
1583 | GNUNET_CONFIGURATION_get_value_filename (cfg, | ||
1584 | "ARM", | ||
1585 | "RESOURCE_DIAGNOSTICS", | ||
1586 | &wait_filename)) | ||
1587 | { | ||
1588 | wait_file = fopen (wait_filename, | ||
1589 | "w"); | ||
1590 | if (NULL == wait_file) | ||
1591 | { | ||
1592 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | ||
1593 | "fopen", | ||
1594 | wait_filename); | ||
1595 | } | ||
1596 | } | ||
1597 | #endif | ||
1505 | if (GNUNET_OK != | 1598 | if (GNUNET_OK != |
1506 | GNUNET_CONFIGURATION_get_value_string (cfg, "ARM", "GLOBAL_PREFIX", | 1599 | GNUNET_CONFIGURATION_get_value_string (cfg, "ARM", "GLOBAL_PREFIX", |
1507 | &prefix_command)) | 1600 | &prefix_command)) |
@@ -1560,6 +1653,18 @@ main (int argc, char *const *argv) | |||
1560 | (GNUNET_OK == | 1653 | (GNUNET_OK == |
1561 | GNUNET_SERVICE_run (argc, argv, "arm", | 1654 | GNUNET_SERVICE_run (argc, argv, "arm", |
1562 | GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN, &run, NULL)) ? 0 : 1; | 1655 | GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN, &run, NULL)) ? 0 : 1; |
1656 | #if HAVE_WAIT4 | ||
1657 | if (NULL != wait_file) | ||
1658 | { | ||
1659 | fclose (wait_file); | ||
1660 | wait_file = NULL; | ||
1661 | } | ||
1662 | if (NULL != wait_filename) | ||
1663 | { | ||
1664 | GNUNET_free (wait_filename); | ||
1665 | wait_filename = NULL; | ||
1666 | } | ||
1667 | #endif | ||
1563 | GNUNET_SIGNAL_handler_uninstall (shc_chld); | 1668 | GNUNET_SIGNAL_handler_uninstall (shc_chld); |
1564 | shc_chld = NULL; | 1669 | shc_chld = NULL; |
1565 | GNUNET_DISK_pipe_close (sigpipe); | 1670 | GNUNET_DISK_pipe_close (sigpipe); |