[sysprof] tracker: Fix the map look up
- From: SÃren Sandmann Pedersen <ssp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] tracker: Fix the map look up
- Date: Fri, 15 Jul 2011 16:28:27 +0000 (UTC)
commit d1f73304eb133ca8fd632d849825635bb67862b9
Author: Damien Lespiau <damien lespiau intel com>
Date: Wed Jul 13 15:03:13 2011 +0100
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.
tracker.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/tracker.c b/tracker.c
index d7e89ba..dfdbec5 100644
--- a/tracker.c
+++ b/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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]