Commit b67d9a52d4720ef56d4fc494538e98e9a1ef5717

Authored by bellard
1 parent a23a9ec6

TCG profiler clean up

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4538 c046a42c-6fe2-441c-8c8c-71466251a162
cpu-all.h
@@ -1063,19 +1063,6 @@ extern int64_t dev_time; @@ -1063,19 +1063,6 @@ extern int64_t dev_time;
1063 extern int64_t kqemu_ret_int_count; 1063 extern int64_t kqemu_ret_int_count;
1064 extern int64_t kqemu_ret_excp_count; 1064 extern int64_t kqemu_ret_excp_count;
1065 extern int64_t kqemu_ret_intr_count; 1065 extern int64_t kqemu_ret_intr_count;
1066 -  
1067 -extern int64_t dyngen_tb_count1;  
1068 -extern int64_t dyngen_tb_count;  
1069 -extern int64_t dyngen_op_count;  
1070 -extern int64_t dyngen_old_op_count;  
1071 -extern int64_t dyngen_tcg_del_op_count;  
1072 -extern int dyngen_op_count_max;  
1073 -extern int64_t dyngen_code_in_len;  
1074 -extern int64_t dyngen_code_out_len;  
1075 -extern int64_t dyngen_interm_time;  
1076 -extern int64_t dyngen_code_time;  
1077 -extern int64_t dyngen_restore_count;  
1078 -extern int64_t dyngen_restore_time;  
1079 #endif 1066 #endif
1080 1067
1081 #endif /* CPU_ALL_H */ 1068 #endif /* CPU_ALL_H */
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 #include "cpu.h" 36 #include "cpu.h"
37 #include "exec-all.h" 37 #include "exec-all.h"
38 #include "qemu-common.h" 38 #include "qemu-common.h"
  39 +#include "tcg.h"
39 #if defined(CONFIG_USER_ONLY) 40 #if defined(CONFIG_USER_ONLY)
40 #include <qemu.h> 41 #include <qemu.h>
41 #endif 42 #endif
@@ -3010,45 +3011,7 @@ void dump_exec_info(FILE *f, @@ -3010,45 +3011,7 @@ void dump_exec_info(FILE *f,
3010 cpu_fprintf(f, "TB flush count %d\n", tb_flush_count); 3011 cpu_fprintf(f, "TB flush count %d\n", tb_flush_count);
3011 cpu_fprintf(f, "TB invalidate count %d\n", tb_phys_invalidate_count); 3012 cpu_fprintf(f, "TB invalidate count %d\n", tb_phys_invalidate_count);
3012 cpu_fprintf(f, "TLB flush count %d\n", tlb_flush_count); 3013 cpu_fprintf(f, "TLB flush count %d\n", tlb_flush_count);
3013 -#ifdef CONFIG_PROFILER  
3014 - {  
3015 - int64_t tot;  
3016 - tot = dyngen_interm_time + dyngen_code_time;  
3017 - cpu_fprintf(f, "JIT cycles %" PRId64 " (%0.3f s at 2.4 GHz)\n",  
3018 - tot, tot / 2.4e9);  
3019 - cpu_fprintf(f, "translated TBs %" PRId64 " (aborted=%" PRId64 " %0.1f%%)\n",  
3020 - dyngen_tb_count,  
3021 - dyngen_tb_count1 - dyngen_tb_count,  
3022 - dyngen_tb_count1 ? (double)(dyngen_tb_count1 - dyngen_tb_count) / dyngen_tb_count1 * 100.0 : 0);  
3023 - cpu_fprintf(f, "avg ops/TB %0.1f max=%d\n",  
3024 - dyngen_tb_count ? (double)dyngen_op_count / dyngen_tb_count : 0, dyngen_op_count_max);  
3025 - cpu_fprintf(f, "old ops/total ops %0.1f%%\n",  
3026 - dyngen_op_count ? (double)dyngen_old_op_count / dyngen_op_count * 100.0 : 0);  
3027 - cpu_fprintf(f, "deleted ops/TB %0.2f\n",  
3028 - dyngen_tb_count ?  
3029 - (double)dyngen_tcg_del_op_count / dyngen_tb_count : 0);  
3030 - cpu_fprintf(f, "cycles/op %0.1f\n",  
3031 - dyngen_op_count ? (double)tot / dyngen_op_count : 0);  
3032 - cpu_fprintf(f, "cycles/in byte %0.1f\n",  
3033 - dyngen_code_in_len ? (double)tot / dyngen_code_in_len : 0);  
3034 - cpu_fprintf(f, "cycles/out byte %0.1f\n",  
3035 - dyngen_code_out_len ? (double)tot / dyngen_code_out_len : 0);  
3036 - if (tot == 0)  
3037 - tot = 1;  
3038 - cpu_fprintf(f, " gen_interm time %0.1f%%\n",  
3039 - (double)dyngen_interm_time / tot * 100.0);  
3040 - cpu_fprintf(f, " gen_code time %0.1f%%\n",  
3041 - (double)dyngen_code_time / tot * 100.0);  
3042 - cpu_fprintf(f, "cpu_restore count %" PRId64 "\n",  
3043 - dyngen_restore_count);  
3044 - cpu_fprintf(f, " avg cycles %0.1f\n",  
3045 - dyngen_restore_count ? (double)dyngen_restore_time / dyngen_restore_count : 0);  
3046 - {  
3047 - extern void dump_op_count(void);  
3048 - dump_op_count();  
3049 - }  
3050 - }  
3051 -#endif 3014 + tcg_dump_info(f, cpu_fprintf);
3052 } 3015 }
3053 3016
3054 #if !defined(CONFIG_USER_ONLY) 3017 #if !defined(CONFIG_USER_ONLY)
translate-all.c
@@ -48,21 +48,6 @@ target_ulong gen_opc_jump_pc[2]; @@ -48,21 +48,6 @@ target_ulong gen_opc_jump_pc[2];
48 uint32_t gen_opc_hflags[OPC_BUF_SIZE]; 48 uint32_t gen_opc_hflags[OPC_BUF_SIZE];
49 #endif 49 #endif
50 50
51 -#ifdef CONFIG_PROFILER  
52 -int64_t dyngen_tb_count1;  
53 -int64_t dyngen_tb_count;  
54 -int64_t dyngen_op_count;  
55 -int64_t dyngen_old_op_count;  
56 -int64_t dyngen_tcg_del_op_count;  
57 -int dyngen_op_count_max;  
58 -int64_t dyngen_code_in_len;  
59 -int64_t dyngen_code_out_len;  
60 -int64_t dyngen_interm_time;  
61 -int64_t dyngen_code_time;  
62 -int64_t dyngen_restore_count;  
63 -int64_t dyngen_restore_time;  
64 -#endif  
65 -  
66 /* XXX: suppress that */ 51 /* XXX: suppress that */
67 unsigned long code_gen_max_block_size(void) 52 unsigned long code_gen_max_block_size(void)
68 { 53 {
@@ -102,8 +87,8 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) @@ -102,8 +87,8 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
102 #endif 87 #endif
103 88
104 #ifdef CONFIG_PROFILER 89 #ifdef CONFIG_PROFILER
105 - dyngen_tb_count1++; /* includes aborted translations because of  
106 - exceptions */ 90 + s->tb_count1++; /* includes aborted translations because of
  91 + exceptions */
107 ti = profile_getclock(); 92 ti = profile_getclock();
108 #endif 93 #endif
109 tcg_func_start(s); 94 tcg_func_start(s);
@@ -129,16 +114,16 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) @@ -129,16 +114,16 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
129 #endif 114 #endif
130 115
131 #ifdef CONFIG_PROFILER 116 #ifdef CONFIG_PROFILER
132 - dyngen_tb_count++;  
133 - dyngen_interm_time += profile_getclock() - ti;  
134 - dyngen_code_time -= profile_getclock(); 117 + s->tb_count++;
  118 + s->interm_time += profile_getclock() - ti;
  119 + s->code_time -= profile_getclock();
135 #endif 120 #endif
136 gen_code_size = dyngen_code(s, gen_code_buf); 121 gen_code_size = dyngen_code(s, gen_code_buf);
137 *gen_code_size_ptr = gen_code_size; 122 *gen_code_size_ptr = gen_code_size;
138 #ifdef CONFIG_PROFILER 123 #ifdef CONFIG_PROFILER
139 - dyngen_code_time += profile_getclock();  
140 - dyngen_code_in_len += tb->size;  
141 - dyngen_code_out_len += gen_code_size; 124 + s->code_time += profile_getclock();
  125 + s->code_in_len += tb->size;
  126 + s->code_out_len += gen_code_size;
142 #endif 127 #endif
143 128
144 #ifdef DEBUG_DISAS 129 #ifdef DEBUG_DISAS
@@ -196,8 +181,8 @@ int cpu_restore_state(TranslationBlock *tb, @@ -196,8 +181,8 @@ int cpu_restore_state(TranslationBlock *tb,
196 gen_pc_load(env, tb, searched_pc, j, puc); 181 gen_pc_load(env, tb, searched_pc, j, puc);
197 182
198 #ifdef CONFIG_PROFILER 183 #ifdef CONFIG_PROFILER
199 - dyngen_restore_time += profile_getclock() - ti;  
200 - dyngen_restore_count++; 184 + s->restore_time += profile_getclock() - ti;
  185 + s->restore_count++;
201 #endif 186 #endif
202 return 0; 187 return 0;
203 } 188 }