… | |
… | |
44 | #ifdef HAVE_SOCKET |
44 | #ifdef HAVE_SOCKET |
45 | #include <stdlib.h> |
45 | #include <stdlib.h> |
46 | #include <sys/socket.h> |
46 | #include <sys/socket.h> |
47 | #include <netinet/in.h> |
47 | #include <netinet/in.h> |
48 | #include <arpa/inet.h> |
48 | #include <arpa/inet.h> |
49 | |
|
|
50 | static int debug_socket=-1; |
49 | static int debug_socket=-1; |
51 | static struct sockaddr_in debug_sin; |
50 | static struct sockaddr_in debug_sin; |
52 | #endif |
51 | #endif |
53 | |
52 | |
54 | |
53 | |
… | |
… | |
236 | } |
235 | } |
237 | |
236 | |
238 | void |
237 | void |
239 | debug_printf(int level, const char *module, const int mlen,const char *function, const int flen, int prefix, const char *fmt, ...) |
238 | debug_printf(int level, const char *module, const int mlen,const char *function, const int flen, int prefix, const char *fmt, ...) |
240 | { |
239 | { |
241 | // __android_log_print(ANDROID_LOG_ERROR,"navit", "aaa11********"); |
|
|
242 | #ifdef _DEBUG_BUILD_ |
240 | #ifdef _DEBUG_BUILD_ |
243 | // __android_log_print(ANDROID_LOG_ERROR,"navit", "aaa22********"); |
|
|
244 | va_list ap; |
241 | va_list ap; |
245 | va_start(ap, fmt); |
242 | va_start(ap, fmt); |
246 | debug_vprintf(level, module, mlen, function, flen, prefix, fmt, ap); |
243 | debug_vprintf(level, module, mlen, function, flen, prefix, fmt, ap); |
247 | va_end(ap); |
244 | va_end(ap); |
248 | #endif |
245 | #endif |
… | |
… | |
430 | debug_free_func(void *ptr) |
427 | debug_free_func(void *ptr) |
431 | { |
428 | { |
432 | debug_free("unknown",0,"unknown",ptr); |
429 | debug_free("unknown",0,"unknown",ptr); |
433 | } |
430 | } |
434 | |
431 | |
|
|
432 | clock_t |
|
|
433 | debug_measure_start(void) |
|
|
434 | { |
|
|
435 | clock_t start = clock(); |
|
|
436 | return start; |
|
|
437 | } |
|
|
438 | |
|
|
439 | clock_t |
|
|
440 | debug_measure_end(clock_t start_time) |
|
|
441 | { |
|
|
442 | clock_t diff_time = clock() - start_time; |
|
|
443 | return diff_time; |
|
|
444 | } |
|
|
445 | |
|
|
446 | int |
|
|
447 | debug_measure_end_tsecs(clock_t start_time) |
|
|
448 | { |
|
|
449 | clock_t diff_time = clock() - start_time; |
|
|
450 | return (int)( ((double)diff_time / (double)CLOCKS_PER_SEC)*1000 ); |
|
|
451 | } |
|
|
452 | |
|
|
453 | void |
|
|
454 | debug_measure_result_str(clock_t diff, char *buffer) |
|
|
455 | { |
|
|
456 | sprintf(buffer, "elapsed: %fs\n", (diff / CLOCKS_PER_SEC)); |
|
|
457 | } |
|
|
458 | |
|
|
459 | void |
|
|
460 | debug_mrp(const char* function_name, clock_t diff) |
|
|
461 | { |
|
|
462 | dbg(0, "el:(%s) %fs\n", function_name, (double)((double)diff / (double)CLOCKS_PER_SEC)); |
|
|
463 | } |
|
|
464 | |
435 | void debug_finished(void) { |
465 | void debug_finished(void) |
|
|
466 | { |
436 | debug_dump_mallocs(); |
467 | debug_dump_mallocs(); |
437 | g_free(gdb_program); |
468 | g_free(gdb_program); |
438 | g_hash_table_destroy(debug_hash); |
469 | g_hash_table_destroy(debug_hash); |
439 | debug_destroy(); |
470 | debug_destroy(); |
440 | } |
471 | } |