mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 10:21:20 +00:00
Small optimisation : use preprocessor for cache stats
as the compiler does not remove the access to the not useful static vars git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15828
This commit is contained in:
parent
64a5086cb1
commit
eb2ffd99ee
@ -1082,8 +1082,13 @@ inline static Int find_nsegment_idx ( Addr a )
|
||||
static Int cache_segidx[N_CACHE];
|
||||
static Bool cache_inited = False;
|
||||
|
||||
# ifdef N_Q_M_STATS
|
||||
static UWord n_q = 0;
|
||||
static UWord n_m = 0;
|
||||
n_q++;
|
||||
if (0 == (n_q & 0xFFFF))
|
||||
VG_(debugLog)(0,"xxx","find_nsegment_idx: %lu %lu\n", n_q, n_m);
|
||||
# endif
|
||||
|
||||
UWord ix;
|
||||
|
||||
@ -1099,10 +1104,6 @@ inline static Int find_nsegment_idx ( Addr a )
|
||||
|
||||
ix = (a >> 12) % N_CACHE;
|
||||
|
||||
n_q++;
|
||||
if (0 && 0 == (n_q & 0xFFFF))
|
||||
VG_(debugLog)(0,"xxx","find_nsegment_idx: %lu %lu\n", n_q, n_m);
|
||||
|
||||
if ((a >> 12) == cache_pageno[ix]
|
||||
&& cache_segidx[ix] >= 0
|
||||
&& cache_segidx[ix] < nsegments_used
|
||||
@ -1113,7 +1114,9 @@ inline static Int find_nsegment_idx ( Addr a )
|
||||
return cache_segidx[ix];
|
||||
}
|
||||
/* miss */
|
||||
# ifdef N_Q_M_STATS
|
||||
n_m++;
|
||||
# endif
|
||||
cache_segidx[ix] = find_nsegment_idx_WRK(a);
|
||||
cache_pageno[ix] = a >> 12;
|
||||
return cache_segidx[ix];
|
||||
|
||||
@ -2664,17 +2664,20 @@ static inline CFSI_m_CacheEnt* cfsi_m_cache__find ( Addr ip )
|
||||
{
|
||||
UWord hash = ip % N_CFSI_M_CACHE;
|
||||
CFSI_m_CacheEnt* ce = &cfsi_m_cache[hash];
|
||||
# ifdef N_Q_M_STATS
|
||||
static UWord n_q = 0, n_m = 0;
|
||||
|
||||
n_q++;
|
||||
if (0 && 0 == (n_q & 0x1FFFFF))
|
||||
if (0 == (n_q & 0x1FFFFF))
|
||||
VG_(printf)("QQQ %lu %lu\n", n_q, n_m);
|
||||
# endif
|
||||
|
||||
if (LIKELY(ce->ip == ip) && LIKELY(ce->di != NULL)) {
|
||||
/* found an entry in the cache .. */
|
||||
} else {
|
||||
/* not found in cache. Search and update. */
|
||||
# ifdef N_Q_M_STATS
|
||||
n_m++;
|
||||
# endif
|
||||
ce->ip = ip;
|
||||
find_DiCfSI( &ce->di, &ce->cfsi_m, ip );
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user