Revision a23a9ec6

b/tcg/tcg.c
1156 1156
                    }
1157 1157
                    tcg_set_nop(s, gen_opc_buf + op_index, args, def->nb_args);
1158 1158
#ifdef CONFIG_PROFILER
1159
                    {
1160
                        extern int64_t dyngen_tcg_del_op_count;
1161
                        dyngen_tcg_del_op_count++;
1162
                    }
1159
                    s->del_op_count++;
1163 1160
#endif
1164 1161
                } else {
1165 1162
                do_not_remove:
......
1822 1819
    }
1823 1820
#endif
1824 1821

  
1822
#ifdef CONFIG_PROFILER
1823
    s->la_time -= profile_getclock();
1824
#endif
1825 1825
    tcg_liveness_analysis(s);
1826
#ifdef CONFIG_PROFILER
1827
    s->la_time += profile_getclock();
1828
#endif
1826 1829

  
1827 1830
#ifdef DEBUG_DISAS
1828 1831
    if (unlikely(loglevel & CPU_LOG_TB_OP_OPT)) {
......
1911 1914
        case 0 ... INDEX_op_end - 1:
1912 1915
            /* legacy dyngen ops */
1913 1916
#ifdef CONFIG_PROFILER
1914
            {
1915
                extern int64_t dyngen_old_op_count;
1916
                dyngen_old_op_count++;
1917
            }
1917
            s->old_op_count++;
1918 1918
#endif
1919 1919
            tcg_reg_alloc_bb_end(s);
1920 1920
            if (search_pc >= 0) {
......
1954 1954
{
1955 1955
#ifdef CONFIG_PROFILER
1956 1956
    {
1957
        extern int64_t dyngen_op_count;
1958
        extern int dyngen_op_count_max;
1959 1957
        int n;
1960 1958
        n = (gen_opc_ptr - gen_opc_buf);
1961
        dyngen_op_count += n;
1962
        if (n > dyngen_op_count_max)
1963
            dyngen_op_count_max = n;
1959
        s->op_count += n;
1960
        if (n > s->op_count_max)
1961
            s->op_count_max = n;
1962

  
1963
        s->temp_count += s->nb_temps;
1964
        if (s->nb_temps > s->temp_count_max)
1965
            s->temp_count_max = s->nb_temps;
1964 1966
    }
1965 1967
#endif
1966 1968

  
......
1980 1982
{
1981 1983
    return tcg_gen_code_common(s, gen_code_buf, offset);
1982 1984
}
1985

  
1986
#ifdef CONFIG_PROFILER
1987
void tcg_dump_info(FILE *f,
1988
                   int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
1989
{
1990
    TCGContext *s = &tcg_ctx;
1991
    int64_t tot;
1992

  
1993
    tot = s->interm_time + s->code_time;
1994
    cpu_fprintf(f, "JIT cycles          %" PRId64 " (%0.3f s at 2.4 GHz)\n",
1995
                tot, tot / 2.4e9);
1996
    cpu_fprintf(f, "translated TBs      %" PRId64 " (aborted=%" PRId64 " %0.1f%%)\n", 
1997
                s->tb_count, 
1998
                s->tb_count1 - s->tb_count,
1999
                s->tb_count1 ? (double)(s->tb_count1 - s->tb_count) / s->tb_count1 * 100.0 : 0);
2000
    cpu_fprintf(f, "avg ops/TB          %0.1f max=%d\n", 
2001
                s->tb_count ? (double)s->op_count / s->tb_count : 0, s->op_count_max);
2002
    cpu_fprintf(f, "old ops/total ops   %0.1f%%\n", 
2003
                s->op_count ? (double)s->old_op_count / s->op_count * 100.0 : 0);
2004
    cpu_fprintf(f, "deleted ops/TB      %0.2f\n",
2005
                s->tb_count ? 
2006
                (double)s->del_op_count / s->tb_count : 0);
2007
    cpu_fprintf(f, "avg temps/TB        %0.2f max=%d\n",
2008
                s->tb_count ? 
2009
                (double)s->temp_count / s->tb_count : 0,
2010
                s->temp_count_max);
2011
    
2012
    cpu_fprintf(f, "cycles/op           %0.1f\n", 
2013
                s->op_count ? (double)tot / s->op_count : 0);
2014
    cpu_fprintf(f, "cycles/in byte      %0.1f\n", 
2015
                s->code_in_len ? (double)tot / s->code_in_len : 0);
2016
    cpu_fprintf(f, "cycles/out byte     %0.1f\n", 
2017
                s->code_out_len ? (double)tot / s->code_out_len : 0);
2018
    if (tot == 0)
2019
        tot = 1;
2020
    cpu_fprintf(f, "  gen_interm time   %0.1f%%\n", 
2021
                (double)s->interm_time / tot * 100.0);
2022
    cpu_fprintf(f, "  gen_code time     %0.1f%%\n", 
2023
                (double)s->code_time / tot * 100.0);
2024
    cpu_fprintf(f, "liveness/code time  %0.1f%%\n", 
2025
                (double)s->la_time / (s->code_time ? s->code_time : 1) * 100.0);
2026
    cpu_fprintf(f, "cpu_restore count   %" PRId64 "\n",
2027
                s->restore_count);
2028
    cpu_fprintf(f, "  avg cycles        %0.1f\n",
2029
                s->restore_count ? (double)s->restore_time / s->restore_count : 0);
2030
    {
2031
        extern void dump_op_count(void);
2032
        dump_op_count();
2033
    }
2034
}
2035
#else
2036
void dump_tcg_info(FILE *f,
2037
                   int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
2038
{
2039
    cpu_fprintf("[TCG profiler not compiled]\n");
2040
}
2041
#endif
b/tcg/tcg.h
236 236
    TCGHelperInfo *helpers;
237 237
    int nb_helpers;
238 238
    int allocated_helpers;
239

  
240
#ifdef CONFIG_PROFILER
241
    /* profiling info */
242
    int64_t tb_count1;
243
    int64_t tb_count;
244
    int64_t op_count; /* total insn count */
245
    int op_count_max; /* max insn per TB */
246
    int64_t temp_count;
247
    int temp_count_max;
248
    int64_t old_op_count;
249
    int64_t del_op_count;
250
    int64_t code_in_len;
251
    int64_t code_out_len;
252
    int64_t interm_time;
253
    int64_t code_time;
254
    int64_t la_time;
255
    int64_t restore_count;
256
    int64_t restore_time;
257
#endif
239 258
};
240 259

  
241 260
extern TCGContext tcg_ctx;
......
281 300
                        const char *name);
282 301
TCGv tcg_temp_new(TCGType type);
283 302
char *tcg_get_arg_str(TCGContext *s, char *buf, int buf_size, TCGv arg);
303
void tcg_dump_info(FILE *f,
304
                   int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
284 305

  
285 306
#define TCG_CT_ALIAS  0x80
286 307
#define TCG_CT_IALIAS 0x40

Also available in: Unified diff