summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-05-10 19:05:54 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-05-10 19:05:54 +0900
commit2aeb289063dba3d71773d2e3dc61573da4847093 (patch)
tree358b695a7477b44c08785ec0416f7d9a772c674a /src/bin
parent1ce417eb8b928053cd21b0fe829923745821aff8 (diff)
eina - begin event log infra we can get from the new debug monitor
we can down dump event logs. some ecore mainloop bits are logging at the moment.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/efl/efl_debug.c21
-rw-r--r--src/bin/efl/efl_debugd.c108
2 files changed, 128 insertions, 1 deletions
diff --git a/src/bin/efl/efl_debug.c b/src/bin/efl/efl_debug.c
index 461238d35d..6a65178a7f 100644
--- a/src/bin/efl/efl_debug.c
+++ b/src/bin/efl/efl_debug.c
@@ -44,7 +44,6 @@ _server_add(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Con_Event_Server
44 { 44 {
45 send_svr(svr, "LIST", NULL, 0); 45 send_svr(svr, "LIST", NULL, 0);
46 expect = "CLST"; 46 expect = "CLST";
47 printf("send... expect %s\n", expect);
48 } 47 }
49 else if ((!strcmp(my_argv[i], "pon")) && 48 else if ((!strcmp(my_argv[i], "pon")) &&
50 (i < (my_argc - 2))) 49 (i < (my_argc - 2)))
@@ -68,6 +67,26 @@ _server_add(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Con_Event_Server
68 send_svr(svr, "PLOF", tmp, sizeof(tmp)); 67 send_svr(svr, "PLOF", tmp, sizeof(tmp));
69 ecore_main_loop_quit(); 68 ecore_main_loop_quit();
70 } 69 }
70 else if ((!strcmp(my_argv[i], "evlogon")) &&
71 (i < (my_argc - 1)))
72 {
73 unsigned char tmp[4];
74 int pid = atoi(my_argv[i + 1]);
75 i++;
76 store_val(tmp, 0, pid);
77 send_svr(svr, "EVON", tmp, sizeof(tmp));
78 ecore_main_loop_quit();
79 }
80 else if ((!strcmp(my_argv[i], "evlogoff")) &&
81 (i < (my_argc - 1)))
82 {
83 unsigned char tmp[4];
84 int pid = atoi(my_argv[i + 1]);
85 i++;
86 store_val(tmp, 0, pid);
87 send_svr(svr, "EVOF", tmp, sizeof(tmp));
88 ecore_main_loop_quit();
89 }
71 } 90 }
72 return ECORE_CALLBACK_RENEW; 91 return ECORE_CALLBACK_RENEW;
73} 92}
diff --git a/src/bin/efl/efl_debugd.c b/src/bin/efl/efl_debugd.c
index b64747f63d..3cfe65d9f6 100644
--- a/src/bin/efl/efl_debugd.c
+++ b/src/bin/efl/efl_debugd.c
@@ -8,6 +8,11 @@ struct _Client
8 unsigned char *buf; 8 unsigned char *buf;
9 unsigned int buf_size; 9 unsigned int buf_size;
10 10
11 Ecore_Timer *evlog_fetch_timer;
12 int evlog_on;
13 FILE *evlog_file;
14 int evlog_inset;
15
11 int version; 16 int version;
12 pid_t pid; 17 pid_t pid;
13}; 18};
@@ -29,6 +34,14 @@ _client_pid_find(int pid)
29 return NULL; 34 return NULL;
30} 35}
31 36
37static Eina_Bool
38_cb_evlog(void *data)
39{
40 Client *c = data;
41 send_cli(c->client, "EVLG", NULL, 0);
42 return EINA_TRUE;
43}
44
32static void 45static void
33_do(Client *c, char *op, unsigned char *d, int size) 46_do(Client *c, char *op, unsigned char *d, int size)
34{ 47{
@@ -84,6 +97,91 @@ _do(Client *c, char *op, unsigned char *d, int size)
84 send_cli(c2->client, "PLOF", NULL, 0); 97 send_cli(c2->client, "PLOF", NULL, 0);
85 } 98 }
86 } 99 }
100 else if (!strcmp(op, "EVON"))
101 {
102 int pid;
103 fetch_val(pid, d, 0);
104 if ((c2 = _client_pid_find(pid)))
105 {
106 c2->evlog_on++;
107 if (c2->evlog_on == 1)
108 {
109 char buf[4096];
110
111 send_cli(c2->client, "EVON", NULL, 0);
112 c2->evlog_fetch_timer = ecore_timer_add(0.2, _cb_evlog, c2);
113 snprintf(buf, sizeof(buf), "%s/efl_debug_evlog-%i.txt",
114 getenv("HOME"), c->pid);
115 c2->evlog_file = fopen(buf, "w");
116 c->evlog_inset = 0;
117 }
118 }
119 }
120 else if (!strcmp(op, "EVOF"))
121 {
122 int pid;
123 fetch_val(pid, d, 0);
124 if ((c2 = _client_pid_find(pid)))
125 {
126 c2->evlog_on--;
127 if (c2->evlog_on == 0)
128 {
129 send_cli(c2->client, "EVOF", NULL, 0);
130 if (c2->evlog_fetch_timer)
131 {
132 ecore_timer_del(c2->evlog_fetch_timer);
133 c2->evlog_fetch_timer = NULL;
134 }
135 if (c2->evlog_file)
136 {
137 fclose(c2->evlog_file);
138 c2->evlog_file = NULL;
139 }
140 }
141 else if (c2->evlog_on < 0)
142 c2->evlog_on = 0;
143 }
144 }
145 else if (!strcmp(op, "EVLG"))
146 {
147// unsigned int *overflow = (unsigned int *)(d + 0);
148// unsigned int *stolen = (unsigned int *)(d + 4);
149 unsigned char *end = d + size;
150 unsigned char *p = d + 8;
151 char *event_str, *detail_str;
152 Eina_Evlog_Item *item;
153 int i, inset;
154
155 printf("EVLG!!!! %i\n", size);
156 inset = c->evlog_inset;
157 if (c->evlog_file)
158 {
159 printf(" have out file\n");
160 while (p < end)
161 {
162 item = (Eina_Evlog_Item *)p;
163 printf(" have item %p\n", p);
164 if ((item->event_next > item->detail_offset) &&
165 ((p + item->event_next) < end))
166 {
167 detail_str = "";
168 event_str = (char *)(p + item->event_offset);
169 if (event_str[0] == '+') inset++;
170 if (item->detail_offset)
171 detail_str = (char *)(p + item->detail_offset);
172 for (i = 0; i < inset; i++) fprintf(c->evlog_file, " ");
173 fprintf(c->evlog_file,
174 "%1.10f [%s] %1.10f 0x%llx 0x%llx %s\n",
175 item->tim, event_str, item->srctim,
176 item->thread, item->obj,
177 detail_str);
178 if (event_str[0] == '-') inset--;
179 }
180 p += item->event_next;
181 }
182 }
183 c->evlog_inset = inset;
184 }
87} 185}
88 186
89static Eina_Bool 187static Eina_Bool
@@ -106,6 +204,16 @@ _client_del(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Con_Event_Client
106 if (c) 204 if (c)
107 { 205 {
108 clients = eina_list_remove(clients, c); 206 clients = eina_list_remove(clients, c);
207 if (c->evlog_fetch_timer)
208 {
209 ecore_timer_del(c->evlog_fetch_timer);
210 c->evlog_fetch_timer = NULL;
211 }
212 if (c->evlog_file)
213 {
214 fclose(c->evlog_file);
215 c->evlog_file = NULL;
216 }
109 free(c); 217 free(c);
110 } 218 }
111 return ECORE_CALLBACK_RENEW; 219 return ECORE_CALLBACK_RENEW;