Enlightenment CVS committal
Author : onefang
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_desktop
Modified Files:
Ecore_Desktop.h ecore_desktop.c ecore_desktop_icon.c
ecore_desktop_paths.c ecore_desktop_private.h
Log Message:
Instrumentation so that we can test performance while of caching.
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/Ecore_Desktop.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- Ecore_Desktop.h 22 Sep 2006 07:51:32 -0000 1.29
+++ Ecore_Desktop.h 22 Sep 2006 10:11:32 -0000 1.30
@@ -132,6 +132,23 @@
Ecore_Desktop_Tree *parent; /* Parent if this is a child. */
};
+struct _Ecore_Desktop_Instrumentation
+{
+ double desktops_time;
+ double desktops_in_cache_time;
+ double desktops_not_found_time;
+ double icons_time;
+ double icons_in_cache_time;
+ double icons_not_found_time;
+ int desktops;
+ int desktops_in_cache;
+ int desktops_not_found;
+ int icons;
+ int icons_in_cache;
+ int icons_not_found;
+};
+
+
# ifdef __cplusplus
extern "C"
{
@@ -245,6 +262,9 @@
Ecore_Desktop_Tree *ecore_desktop_xmlame_get(char *file);
char *ecore_desktop_home_get(void);
+
+ EAPI void ecore_desktop_instrumentation_reset(void);
+ EAPI void ecore_desktop_instrumentation_print(void);
# ifdef __cplusplus
}
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- ecore_desktop.c 22 Sep 2006 06:07:58 -0000 1.36
+++ ecore_desktop.c 22 Sep 2006 10:11:32 -0000 1.37
@@ -8,13 +8,7 @@
#include <ctype.h>
#include <sys/stat.h>
-Ecore_List *ecore_desktop_paths_config = NULL;
-Ecore_List *ecore_desktop_paths_menus = NULL;
-Ecore_List *ecore_desktop_paths_directories = NULL;
-Ecore_List *ecore_desktop_paths_desktops = NULL;
-Ecore_List *ecore_desktop_paths_icons = NULL;
-Ecore_List *ecore_desktop_paths_kde_legacy = NULL;
-Ecore_List *ecore_desktop_paths_xsessions = NULL;
+struct _Ecore_Desktop_Instrumentation instrumentation;
extern int reject_count, not_over_count;
@@ -188,19 +182,23 @@
struct stat st;
char *value;
int stated = 0;
+ int in_cache = 0;
+ double begin;
+ begin = ecore_time_get();
result = (Ecore_Desktop *) ecore_hash_get(desktop_cache, (char *)file);
/* Check if the cache is still valid. */
if (result)
{
+ in_cache = 1;
if (stat(result->original_path, &st) >= 0)
{
if (st.st_mtime > result->mtime)
{
ecore_hash_remove(desktop_cache, result->original_path);
result = NULL;
- stated = 1;
}
+ stated = 1;
}
}
if (!result)
@@ -215,10 +213,7 @@
result->data = ecore_desktop_ini_get(result->original_path);
/* Timestamp the cache, and no need to stat the file twice if the
cache was stale. */
if ((stated) || (stat(result->original_path, &st) >= 0))
- {
- result->mtime = st.st_mtime;
- stated = 1;
- }
+ result->mtime = st.st_mtime;
if (result->data)
{
result->group =
@@ -499,6 +494,25 @@
}
}
}
+
+ if (result)
+ {
+ if (in_cache)
+ {
+ instrumentation.desktops_in_cache_time += ecore_time_get() -
begin;
+ instrumentation.desktops_in_cache++;
+ }
+ else
+ {
+ instrumentation.desktops_time += ecore_time_get() - begin;
+ instrumentation.desktops++;
+ }
+ }
+ else
+ {
+ instrumentation.desktops_not_found_time += ecore_time_get() - begin;
+ instrumentation.desktops_not_found++;
+ }
return result;
}
@@ -971,4 +985,37 @@
result = strdup(exec);
return result;
+}
+
+EAPI void
+ecore_desktop_instrumentation_reset(void)
+{
+ instrumentation.desktops = 0;
+ instrumentation.desktops_in_cache = 0;
+ instrumentation.desktops_not_found = 0;
+ instrumentation.icons = 0;
+ instrumentation.icons_in_cache = 0;
+ instrumentation.icons_not_found = 0;
+ instrumentation.desktops_time = 0.0;
+ instrumentation.desktops_in_cache_time = 0.0;
+ instrumentation.desktops_not_found_time = 0.0;
+ instrumentation.icons_time = 0.0;
+ instrumentation.icons_in_cache_time = 0.0;
+ instrumentation.icons_not_found_time = 0.0;
+ printf("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n");
+ printf("Desktop instrumentation reset.\n");
+ printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
+}
+
+EAPI void
+ecore_desktop_instrumentation_print(void)
+{
+ printf("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n");
+ printf(" Found %5d desktops %2.5f (%2.6f/desktop)\n",
instrumentation.desktops, instrumentation.desktops_time,
instrumentation.desktops_time / instrumentation.desktops);
+ printf(" Found %5d desktops in cache %2.5f (%2.6f/desktop)\n",
instrumentation.desktops_in_cache, instrumentation.desktops_in_cache_time,
instrumentation.desktops_in_cache_time / instrumentation.desktops_in_cache);
+ printf("Not found %5d desktops %2.5f (%2.6f/desktop)\n",
instrumentation.desktops_not_found, instrumentation.desktops_not_found_time,
instrumentation.desktops_not_found_time / instrumentation.desktops_not_found);
+ printf(" Found %5d icons %2.5f (%2.6f/icon)\n",
instrumentation.icons, instrumentation.icons_time, instrumentation.icons_time /
instrumentation.icons);
+ printf(" Found %5d icons in cache %2.5f (%2.6f/icon)\n",
instrumentation.icons_in_cache, instrumentation.icons_in_cache_time,
instrumentation.icons_in_cache_time / instrumentation.icons_in_cache);
+ printf("Not found %5d icons %2.5f (%2.6f/icon)\n",
instrumentation.icons_not_found, instrumentation.icons_not_found_time,
instrumentation.icons_not_found_time / instrumentation.icons_not_found);
+ printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
}
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_icon.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- ecore_desktop_icon.c 22 Sep 2006 07:51:32 -0000 1.21
+++ ecore_desktop_icon.c 22 Sep 2006 10:11:32 -0000 1.22
@@ -19,7 +19,7 @@
/* FIXME: We need a way for the client to disable searching for any of these
that they don't support. */
static const char *ext[] =
- { ".edj", ".png", ".svgz", ".svg", ".xpm", "", NULL };
+ { ".edj", ".png", ".svgz", ".svg", ".xpm", NULL };
static int init_count = 0;
static Ecore_Hash *icon_theme_cache;
static int loaded = 0;
@@ -53,7 +53,10 @@
{
const char *dir = NULL, *icn;
Ecore_List *icons;
+ int in_cache = 0;
+ double begin;
+ begin = ecore_time_get();
if (icon == NULL)
return NULL;
@@ -85,6 +88,24 @@
}
ecore_list_destroy(icons);
+ if (dir)
+ {
+ if (in_cache)
+ {
+ instrumentation.icons_in_cache_time += ecore_time_get() - begin;
+ instrumentation.icons_in_cache++;
+ }
+ else
+ {
+ instrumentation.icons_time += ecore_time_get() - begin;
+ instrumentation.icons++;
+ }
+ }
+ else
+ {
+ instrumentation.icons_not_found_time += ecore_time_get() - begin;
+ instrumentation.icons_not_found++;
+ }
return dir;
}
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_paths.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- ecore_desktop_paths.c 22 Sep 2006 06:07:58 -0000 1.25
+++ ecore_desktop_paths.c 22 Sep 2006 10:11:32 -0000 1.26
@@ -36,6 +36,15 @@
* and correct those guesses.
*/
+Ecore_List *ecore_desktop_paths_config = NULL;
+Ecore_List *ecore_desktop_paths_menus = NULL;
+Ecore_List *ecore_desktop_paths_directories = NULL;
+Ecore_List *ecore_desktop_paths_desktops = NULL;
+Ecore_List *ecore_desktop_paths_icons = NULL;
+Ecore_List *ecore_desktop_paths_kde_legacy = NULL;
+Ecore_List *ecore_desktop_paths_xsessions = NULL;
+
+
static Ecore_List *_ecore_desktop_paths_get(Ecore_Desktop_Paths_Type
path_type,
char *before, char *env_home,
char *env, char *env_home_default,
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_private.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ecore_desktop_private.h 22 Sep 2006 06:08:42 -0000 1.6
+++ ecore_desktop_private.h 22 Sep 2006 10:11:32 -0000 1.7
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
+#include <Ecore.h>
#include <Ecore_File.h>
#define E_FN_DEL(_fn, _h) if (_h) { _fn(_h); _h = NULL; }
@@ -22,6 +23,8 @@
extern Ecore_List *ecore_desktop_paths_icons;
extern Ecore_List *ecore_desktop_paths_kde_legacy;
extern Ecore_List *ecore_desktop_paths_xsessions;
+extern struct _Ecore_Desktop_Instrumentation instrumentation;
+
# ifdef __cplusplus
extern "C"
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs