Add debug code

This commit is contained in:
jun7 2018-06-07 18:20:03 +09:00
parent 173159a761
commit 45f3568678

View File

@ -494,7 +494,7 @@ static gboolean tcinputcb(GIOChannel *ch, GIOCondition c, char *exe)
GThreadPool *pool = g_thread_pool_new(testget, exe, 44, false, NULL); GThreadPool *pool = g_thread_pool_new(testget, exe, 44, false, NULL);
start = g_get_monotonic_time(); start = g_get_monotonic_time();
for (int i = 0; i < 100000; i++) for (int i = 0; i < 10000; i++)
{ {
char *is = g_strdup_printf("l%d", i); char *is = g_strdup_printf("l%d", i);
//g_print("loop %d ret %s\n", i, wyebget(exe, is)); //g_print("loop %d ret %s\n", i, wyebget(exe, is));
@ -502,9 +502,18 @@ static gboolean tcinputcb(GIOChannel *ch, GIOCondition c, char *exe)
wyebsend(exe, is); wyebsend(exe, is);
else if (*(line + 1) == 'p') else if (*(line + 1) == 'p')
D(pint %s, is) D(pint %s, is)
else if (*(line + 1) == 'c')
{
gchar *data;
g_spawn_command_line_sync("echo 'ret'", &data, NULL, NULL, NULL);
g_strchomp(data);
D(cmd %s %s, is, data)
g_free(data);
}
else else
g_thread_pool_push(pool, g_strdup(is), NULL); g_thread_pool_push(pool, g_strdup(is), NULL);
// wyebget(exe, is); // wyebget(exe, is);
g_free(is); g_free(is);
} }
g_thread_pool_free(pool, false, true); g_thread_pool_free(pool, false, true);
@ -513,10 +522,8 @@ static gboolean tcinputcb(GIOChannel *ch, GIOCondition c, char *exe)
D(time %f, (now - start) / 1000000.0) D(time %f, (now - start) / 1000000.0)
} }
else else
g_print("RET is %s\n", wyebget(exe, line));
#else
g_print("%s\n", wyebget(exe, line)); //don't free
#endif #endif
P(%s, wyebget(exe, line))
g_free(line); g_free(line);
return true; return true;