/[zanavi_public1]/navit/navit/debug.c
ZANavi

Diff of /navit/navit/debug.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 27 Revision 28
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
50static int debug_socket=-1; 49static int debug_socket=-1;
51static struct sockaddr_in debug_sin; 50static struct sockaddr_in debug_sin;
52#endif 51#endif
53 52
54 53
236} 235}
237 236
238void 237void
239debug_printf(int level, const char *module, const int mlen,const char *function, const int flen, int prefix, const char *fmt, ...) 238debug_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
430debug_free_func(void *ptr) 427debug_free_func(void *ptr)
431{ 428{
432 debug_free("unknown",0,"unknown",ptr); 429 debug_free("unknown",0,"unknown",ptr);
433} 430}
434 431
432clock_t
433debug_measure_start(void)
434{
435 clock_t start = clock();
436 return start;
437}
438
439clock_t
440debug_measure_end(clock_t start_time)
441{
442 clock_t diff_time = clock() - start_time;
443 return diff_time;
444}
445
446int
447debug_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
453void
454debug_measure_result_str(clock_t diff, char *buffer)
455{
456 sprintf(buffer, "elapsed: %fs\n", (diff / CLOCKS_PER_SEC));
457}
458
459void
460debug_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
435void debug_finished(void) { 465void 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}

Legend:
Removed from v.27  
changed lines
  Added in v.28

   
Visit the ZANavi Wiki