summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2016-03-15 13:31:03 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2016-03-15 13:31:06 +0200
commit85c3699b9cb07887813f0b7a1cd297636d97d5a2 (patch)
tree03849efb1abd1fd30f8fc8ff1d24ed085803895a
parent13b4b2a840f46f8798f62bdef55bd26edf0650ff (diff)
Fix issue when multi-process/thread is used
The problem happened in efl make check, when tests are forked. As Espion was saving the stats in one specific file, new stats were removing previous ones. This patch fixes it by writing the output in a file whose name is determined by its pid.
-rw-r--r--src/lib/cov_preload.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/cov_preload.c b/src/lib/cov_preload.c
index 58a4d7e..f384e9b 100644
--- a/src/lib/cov_preload.c
+++ b/src/lib/cov_preload.c
@@ -1,6 +1,7 @@
1#define _GNU_SOURCE 1#define _GNU_SOURCE
2#include <dlfcn.h> 2#include <dlfcn.h>
3#include <signal.h> 3#include <signal.h>
4#include <unistd.h>
4 5
5#ifndef ELM_INTERNAL_API_ARGESFSDFEFC 6#ifndef ELM_INTERNAL_API_ARGESFSDFEFC
6#define ELM_INTERNAL_API_ARGESFSDFEFC 7#define ELM_INTERNAL_API_ARGESFSDFEFC
@@ -13,10 +14,19 @@ Stat_Infos infos;
13static Eina_Bool _changed = EINA_FALSE; 14static Eina_Bool _changed = EINA_FALSE;
14 15
15static void 16static void
17_save()
18{
19 int pid = getpid();
20 char name[128];
21 sprintf(name, "espion_stats_%d.eet", pid);
22 stats_save(&infos, name, STATS_EET_FORMAT);
23}
24
25static void
16_sig_prof_bt(int sig EINA_UNUSED, siginfo_t *si EINA_UNUSED, void *foo EINA_UNUSED) 26_sig_prof_bt(int sig EINA_UNUSED, siginfo_t *si EINA_UNUSED, void *foo EINA_UNUSED)
17{ 27{
18 printf("Saving stats\n"); 28 printf("Saving stats\n");
19 stats_save(&infos, "espion_stats.eet", STATS_EET_FORMAT); 29 _save();
20} 30}
21 31
22static void 32static void
@@ -43,7 +53,7 @@ eina_shutdown()
43 53
44 if (_changed) 54 if (_changed)
45 { 55 {
46 stats_save(&infos, "espion_stats.eet", STATS_EET_FORMAT); 56 _save();
47 _changed = EINA_FALSE; 57 _changed = EINA_FALSE;
48 } 58 }
49 59