You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2017/05/30 21:32:34 UTC

[trafficserver] branch master updated: Add logic to flush gcov data from traffic_server on interrupt.

This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  1f54cf0   Add logic to flush gcov data from traffic_server on interrupt.
1f54cf0 is described below

commit 1f54cf0c41d3bcb09f4759ccbee509d14ec1ded9
Author: Susan Hinrichs <sh...@ieee.org>
AuthorDate: Tue May 30 20:42:49 2017 +0000

    Add logic to flush gcov data from traffic_server on interrupt.
---
 configure.ac           | 4 +++-
 lib/ts/ink_config.h.in | 1 +
 proxy/Main.cc          | 9 +++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 7401e1e..2c3fae6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,13 +176,15 @@ AC_ARG_ENABLE([mime-sanity-check],
 AC_MSG_RESULT([$enable_mime_sanity_check])
 
 # Enable code coverage instrumentation only if requested by the user.
+use_gcov=0
 AC_MSG_CHECKING([whether to code coverage])
 AC_ARG_ENABLE([coverage],
   [AS_HELP_STRING([--enable-coverage],[generate code coverage instrumentation])],
-  [],
+  [use_gcov=1],
   [enable_coverage=no]
 )
 AC_MSG_RESULT([$enable_coverage])
+AC_SUBST(use_gcov)
 
 #
 # Enable -Werror. We want this enabled by default for developers, but disabled by default
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index b96692f..475ac90 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -58,6 +58,7 @@
 #define TS_HAS_IN6_IS_ADDR_UNSPECIFIED @has_in6_is_addr_unspecified@
 #define TS_HAS_BACKTRACE @has_backtrace@
 #define TS_HAS_PROFILER @has_profiler@
+#define TS_USE_GCOV @use_gcov@
 #define TS_USE_FAST_SDK @use_fast_sdk@
 #define TS_USE_DIAGS @use_diags@
 #define TS_USE_EPOLL @use_epoll@
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 9c7548c..1f48517 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -91,6 +91,7 @@ extern "C" int plock(int);
 #include "I_Tasks.h"
 #include "InkAPIInternal.h"
 #include "HTTP2.h"
+#include "ts/ink_config.h"
 
 #include <ts/ink_cap.h>
 
@@ -99,6 +100,10 @@ extern "C" int plock(int);
 #include <gperftools/heap-profiler.h>
 #endif
 
+#if TS_USE_GCOV
+extern "C" void __gcov_flush();
+#endif
+
 //
 // Global Data
 //
@@ -445,6 +450,10 @@ proxy_signal_handler(int signo, siginfo_t *info, void *ctx)
   ProfilerStop();
 #endif
 
+#if TS_USE_GCOV
+  __gcov_flush();
+#endif
+
   // We don't expect any crashing signals here because, but
   // forward to the default handler just to be robust.
   if (signal_is_crash(signo)) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].

Re: [trafficserver] branch master updated: Add logic to flush gcov data from traffic_server on interrupt.

Posted by James Peach <ja...@me.com>.
It seems pretty unlikely that __gcov_flush() is async signal safe so we can't safely call it from a signal handler. #1937 is trying to fix the shutdown sequence so this kind of thing can be done safely.


> On May 30, 2017, at 2:32 PM, shinrich@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> shinrich pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/trafficserver.git
> 
> The following commit(s) were added to refs/heads/master by this push:
>       new  1f54cf0   Add logic to flush gcov data from traffic_server on interrupt.
> 1f54cf0 is described below
> 
> commit 1f54cf0c41d3bcb09f4759ccbee509d14ec1ded9
> Author: Susan Hinrichs <sh...@ieee.org>
> AuthorDate: Tue May 30 20:42:49 2017 +0000
> 
>    Add logic to flush gcov data from traffic_server on interrupt.
> ---
> configure.ac           | 4 +++-
> lib/ts/ink_config.h.in | 1 +
> proxy/Main.cc          | 9 +++++++++
> 3 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 7401e1e..2c3fae6 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -176,13 +176,15 @@ AC_ARG_ENABLE([mime-sanity-check],
> AC_MSG_RESULT([$enable_mime_sanity_check])
> 
> # Enable code coverage instrumentation only if requested by the user.
> +use_gcov=0
> AC_MSG_CHECKING([whether to code coverage])
> AC_ARG_ENABLE([coverage],
>   [AS_HELP_STRING([--enable-coverage],[generate code coverage instrumentation])],
> -  [],
> +  [use_gcov=1],
>   [enable_coverage=no]
> )
> AC_MSG_RESULT([$enable_coverage])
> +AC_SUBST(use_gcov)
> 
> #
> # Enable -Werror. We want this enabled by default for developers, but disabled by default
> diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
> index b96692f..475ac90 100644
> --- a/lib/ts/ink_config.h.in
> +++ b/lib/ts/ink_config.h.in
> @@ -58,6 +58,7 @@
> #define TS_HAS_IN6_IS_ADDR_UNSPECIFIED @has_in6_is_addr_unspecified@
> #define TS_HAS_BACKTRACE @has_backtrace@
> #define TS_HAS_PROFILER @has_profiler@
> +#define TS_USE_GCOV @use_gcov@
> #define TS_USE_FAST_SDK @use_fast_sdk@
> #define TS_USE_DIAGS @use_diags@
> #define TS_USE_EPOLL @use_epoll@
> diff --git a/proxy/Main.cc b/proxy/Main.cc
> index 9c7548c..1f48517 100644
> --- a/proxy/Main.cc
> +++ b/proxy/Main.cc
> @@ -91,6 +91,7 @@ extern "C" int plock(int);
> #include "I_Tasks.h"
> #include "InkAPIInternal.h"
> #include "HTTP2.h"
> +#include "ts/ink_config.h"
> 
> #include <ts/ink_cap.h>
> 
> @@ -99,6 +100,10 @@ extern "C" int plock(int);
> #include <gperftools/heap-profiler.h>
> #endif
> 
> +#if TS_USE_GCOV
> +extern "C" void __gcov_flush();
> +#endif
> +
> //
> // Global Data
> //
> @@ -445,6 +450,10 @@ proxy_signal_handler(int signo, siginfo_t *info, void *ctx)
>   ProfilerStop();
> #endif
> 
> +#if TS_USE_GCOV
> +  __gcov_flush();
> +#endif
> +
>   // We don't expect any crashing signals here because, but
>   // forward to the default handler just to be robust.
>   if (signal_is_crash(signo)) {
> 
> -- 
> To stop receiving notification emails like this one, please contact
> ['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].