mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
tracker: Fix the map look up
A few commits ago, an attempt to speed the map look up was done. Unfortunatly, it was missing the case where you actually hit the speed up (once the map is the first element of the array, you never return it). So, make sure that if i is 0, you return the first element of array, while still doing the array reordering is i > 0.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
791fff95c3
commit
d1f73304eb
15
tracker.c
15
tracker.c
@ -417,15 +417,18 @@ process_locate_map (process_t *process, gulong addr)
|
||||
{
|
||||
map_t *map = &g_array_index (maps, map_t, i);
|
||||
|
||||
if (addr >= map->start && addr < map->end && i > 0)
|
||||
if (addr >= map->start && addr < map->end)
|
||||
{
|
||||
map_t tmp = *map;
|
||||
if (i > 0)
|
||||
{
|
||||
map_t tmp = *map;
|
||||
|
||||
memmove (&(g_array_index (maps, map_t, 1)),
|
||||
&(g_array_index (maps, map_t, 0)),
|
||||
i * sizeof (map_t));
|
||||
memmove (&(g_array_index (maps, map_t, 1)),
|
||||
&(g_array_index (maps, map_t, 0)),
|
||||
i * sizeof (map_t));
|
||||
|
||||
g_array_index (maps, map_t, 0) = tmp;
|
||||
g_array_index (maps, map_t, 0) = tmp;
|
||||
}
|
||||
|
||||
return &g_array_index (maps, map_t, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user