tracker r2038 - in branches/indexer-split: . src/libstemmer src/libtracker-common src/tracker-indexer src/trackerd tests/libtracker-common
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2038 - in branches/indexer-split: . src/libstemmer src/libtracker-common src/tracker-indexer src/trackerd tests/libtracker-common
- Date: Fri, 8 Aug 2008 11:38:08 +0000 (UTC)
Author: mr
Date: Fri Aug 8 11:38:07 2008
New Revision: 2038
URL: http://svn.gnome.org/viewvc/tracker?rev=2038&view=rev
Log:
* src/libstemmer/Makefile.am:
* src/trackerd/Makefile.am:
* src/tracker-indexer/Makefile.am:
* tests/libtracker-common/Makefile.am: Renamed .la to just
libstemmer from libstemmer-private.
* src/libtracker-common/Makefile.am: Added libstemmer to the .la
files we need so the tests don't fail to build.
* src/libtracker-common/tracker-language.c: Fixed include path for
libstemmer.
* src/libtracker-common/tracker-utils.[ch]:
* src/trackerd/tracker-crawler.c:
* src/tracker-indexer/tracker-indexer.c: Added throttle function
we use in the indexer to a common place for the daemon to use too.
* src/trackerd/tracker-main.c: Add the throttle value to the
sanity check for variables.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libstemmer/Makefile.am
branches/indexer-split/src/libtracker-common/Makefile.am
branches/indexer-split/src/libtracker-common/tracker-language.c
branches/indexer-split/src/libtracker-common/tracker-utils.c
branches/indexer-split/src/libtracker-common/tracker-utils.h
branches/indexer-split/src/tracker-indexer/Makefile.am
branches/indexer-split/src/tracker-indexer/tracker-indexer.c
branches/indexer-split/src/tracker-indexer/tracker-main.c
branches/indexer-split/src/trackerd/Makefile.am
branches/indexer-split/src/trackerd/tracker-crawler.c
branches/indexer-split/src/trackerd/tracker-main.c
branches/indexer-split/tests/libtracker-common/Makefile.am
Modified: branches/indexer-split/src/libstemmer/Makefile.am
==============================================================================
--- branches/indexer-split/src/libstemmer/Makefile.am (original)
+++ branches/indexer-split/src/libstemmer/Makefile.am Fri Aug 8 11:38:07 2008
@@ -1,40 +1,39 @@
+noinst_LTLIBRARIES = libstemmer.la
-noinst_LTLIBRARIES=libstemmer-private.la
-
-libstemmer_private_la_SOURCES = \
- libstemmer/libstemmer.c \
- runtime/api.c \
- runtime/utilities.c \
- src_c/stem_UTF_8_danish.c \
- src_c/stem_UTF_8_dutch.c \
- src_c/stem_UTF_8_english.c \
- src_c/stem_UTF_8_finnish.c \
- src_c/stem_UTF_8_french.c \
- src_c/stem_UTF_8_german.c \
- src_c/stem_UTF_8_hungarian.c \
- src_c/stem_UTF_8_italian.c \
- src_c/stem_UTF_8_norwegian.c \
- src_c/stem_UTF_8_porter.c \
- src_c/stem_UTF_8_portuguese.c \
- src_c/stem_UTF_8_russian.c \
- src_c/stem_UTF_8_spanish.c \
- src_c/stem_UTF_8_swedish.c \
- include/libstemmer.h \
- libstemmer/modules.h \
- runtime/api.h \
- runtime/header.h \
- src_c/stem_UTF_8_danish.h \
- src_c/stem_UTF_8_dutch.h \
- src_c/stem_UTF_8_english.h \
- src_c/stem_UTF_8_finnish.h \
- src_c/stem_UTF_8_french.h \
- src_c/stem_UTF_8_german.h \
- src_c/stem_UTF_8_hungarian.h \
- src_c/stem_UTF_8_italian.h \
- src_c/stem_UTF_8_norwegian.h \
- src_c/stem_UTF_8_porter.h \
- src_c/stem_UTF_8_portuguese.h \
- src_c/stem_UTF_8_russian.h \
- src_c/stem_UTF_8_spanish.h \
+libstemmer_la_SOURCES = \
+ libstemmer/libstemmer.c \
+ runtime/api.c \
+ runtime/utilities.c \
+ src_c/stem_UTF_8_danish.c \
+ src_c/stem_UTF_8_dutch.c \
+ src_c/stem_UTF_8_english.c \
+ src_c/stem_UTF_8_finnish.c \
+ src_c/stem_UTF_8_french.c \
+ src_c/stem_UTF_8_german.c \
+ src_c/stem_UTF_8_hungarian.c \
+ src_c/stem_UTF_8_italian.c \
+ src_c/stem_UTF_8_norwegian.c \
+ src_c/stem_UTF_8_porter.c \
+ src_c/stem_UTF_8_portuguese.c \
+ src_c/stem_UTF_8_russian.c \
+ src_c/stem_UTF_8_spanish.c \
+ src_c/stem_UTF_8_swedish.c \
+ include/libstemmer.h \
+ libstemmer/modules.h \
+ runtime/api.h \
+ runtime/header.h \
+ src_c/stem_UTF_8_danish.h \
+ src_c/stem_UTF_8_dutch.h \
+ src_c/stem_UTF_8_english.h \
+ src_c/stem_UTF_8_finnish.h \
+ src_c/stem_UTF_8_french.h \
+ src_c/stem_UTF_8_german.h \
+ src_c/stem_UTF_8_hungarian.h \
+ src_c/stem_UTF_8_italian.h \
+ src_c/stem_UTF_8_norwegian.h \
+ src_c/stem_UTF_8_porter.h \
+ src_c/stem_UTF_8_portuguese.h \
+ src_c/stem_UTF_8_russian.h \
+ src_c/stem_UTF_8_spanish.h \
src_c/stem_UTF_8_swedish.h
Modified: branches/indexer-split/src/libtracker-common/Makefile.am
==============================================================================
--- branches/indexer-split/src/libtracker-common/Makefile.am (original)
+++ branches/indexer-split/src/libtracker-common/Makefile.am Fri Aug 8 11:38:07 2008
@@ -1,12 +1,12 @@
-INCLUDES = \
- -DSHAREDIR=\""$(datadir)"\" \
- -DG_LOG_DOMAIN=\"Tracker\" \
- -I$(top_srcdir)/src \
- $(HAL_CFLAGS) \
- $(DBUS_CFLAGS) \
- $(UNAC_CFLAGS) \
- $(PANGO_CFLAGS) \
- $(GIO_CFLAGS) \
+INCLUDES = \
+ -DSHAREDIR=\""$(datadir)"\" \
+ -DG_LOG_DOMAIN=\"Tracker\" \
+ -I$(top_srcdir)/src \
+ $(HAL_CFLAGS) \
+ $(DBUS_CFLAGS) \
+ $(UNAC_CFLAGS) \
+ $(PANGO_CFLAGS) \
+ $(GIO_CFLAGS) \
$(GLIB2_CFLAGS)
noinst_LTLIBRARIES = libtracker-common.la
@@ -18,54 +18,55 @@
endif
if HAVE_HAL
-hal_sources = \
- tracker-hal.c \
+hal_sources = \
+ tracker-hal.c \
tracker-hal.h
endif
-libtracker_common_la_SOURCES = \
- $(os_sources) \
- $(hal_sources) \
- tracker-configuration.c \
- tracker-configuration.h \
- tracker-config.c \
- tracker-config.h \
- tracker-dbus.c \
- tracker-dbus.h \
- tracker-field.c \
- tracker-field.h \
- tracker-field-data.c \
- tracker-field-data.h \
- tracker-file-utils.c \
- tracker-file-utils.h \
- tracker-ioprio.c \
- tracker-ioprio.h \
- tracker-language.c \
- tracker-language.h \
- tracker-log.c \
- tracker-log.h \
- tracker-module-config.c \
- tracker-module-config.h \
- tracker-nfs-lock.c \
- tracker-nfs-lock.h \
- tracker-ontology.c \
- tracker-ontology.h \
- tracker-os-dependant.h \
- tracker-parser.c \
- tracker-parser.h \
- tracker-service.c \
- tracker-service.h \
- tracker-type-utils.c \
- tracker-type-utils.h \
- tracker-utils.c \
+libtracker_common_la_SOURCES = \
+ $(os_sources) \
+ $(hal_sources) \
+ tracker-configuration.c \
+ tracker-configuration.h \
+ tracker-config.c \
+ tracker-config.h \
+ tracker-dbus.c \
+ tracker-dbus.h \
+ tracker-field.c \
+ tracker-field.h \
+ tracker-field-data.c \
+ tracker-field-data.h \
+ tracker-file-utils.c \
+ tracker-file-utils.h \
+ tracker-ioprio.c \
+ tracker-ioprio.h \
+ tracker-language.c \
+ tracker-language.h \
+ tracker-log.c \
+ tracker-log.h \
+ tracker-module-config.c \
+ tracker-module-config.h \
+ tracker-nfs-lock.c \
+ tracker-nfs-lock.h \
+ tracker-ontology.c \
+ tracker-ontology.h \
+ tracker-os-dependant.h \
+ tracker-parser.c \
+ tracker-parser.h \
+ tracker-service.c \
+ tracker-service.h \
+ tracker-type-utils.c \
+ tracker-type-utils.h \
+ tracker-utils.c \
tracker-utils.h
libtracker_common_la_LDFLAGS = -version-info 0:0:0
-libtracker_common_la_LIBADD = \
- $(HAL_LIBS) \
- $(DBUS_LIBS) \
- $(UNAC_LIBS) \
- $(PANGO_LIBS) \
- $(GIO_LIBS) \
+libtracker_common_la_LIBADD = \
+ $(top_builddir)/src/libstemmer/libstemmer.la \
+ $(HAL_LIBS) \
+ $(DBUS_LIBS) \
+ $(UNAC_LIBS) \
+ $(PANGO_LIBS) \
+ $(GIO_LIBS) \
$(GLIB2_LIBS)
Modified: branches/indexer-split/src/libtracker-common/tracker-language.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-language.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-language.c Fri Aug 8 11:38:07 2008
@@ -25,7 +25,7 @@
#include <glib.h>
-#include "../libstemmer/include/libstemmer.h"
+#include <libstemmer/include/libstemmer.h>
#include "tracker-log.h"
#include "tracker-language.h"
Modified: branches/indexer-split/src/libtracker-common/tracker-utils.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-utils.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-utils.c Fri Aug 8 11:38:07 2008
@@ -217,3 +217,24 @@
return str;
}
+
+void
+tracker_throttle (TrackerConfig *config,
+ gint multiplier)
+{
+ gint throttle;
+
+ g_return_if_fail (TRACKER_IS_CONFIG (config));
+
+ throttle = tracker_config_get_throttle (config);
+
+ if (throttle < 1) {
+ return;
+ }
+
+ throttle *= multiplier;
+
+ if (throttle > 0) {
+ g_usleep (throttle);
+ }
+}
Modified: branches/indexer-split/src/libtracker-common/tracker-utils.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-utils.h (original)
+++ branches/indexer-split/src/libtracker-common/tracker-utils.h Fri Aug 8 11:38:07 2008
@@ -24,18 +24,22 @@
#include <glib.h>
-gboolean tracker_is_empty_string (const char *str);
-gchar * tracker_string_replace (const gchar *haystack,
- gchar *needle,
- gchar *replacement);
-gchar * tracker_string_remove (gchar *haystack,
- const gchar *needle);
-gchar * tracker_escape_string (const gchar *in);
-gchar * tracker_seconds_estimate_to_string (gdouble seconds_elapsed,
- gboolean short_string,
- guint items_done,
- guint items_remaining);
-gchar * tracker_seconds_to_string (gdouble seconds_elapsed,
- gboolean short_string);
+#include "tracker-config.h"
+
+gboolean tracker_is_empty_string (const char *str);
+gchar * tracker_string_replace (const gchar *haystack,
+ gchar *needle,
+ gchar *replacement);
+gchar * tracker_string_remove (gchar *haystack,
+ const gchar *needle);
+gchar * tracker_escape_string (const gchar *in);
+gchar * tracker_seconds_estimate_to_string (gdouble seconds_elapsed,
+ gboolean short_string,
+ guint items_done,
+ guint items_remaining);
+gchar * tracker_seconds_to_string (gdouble seconds_elapsed,
+ gboolean short_string);
+void tracker_throttle (TrackerConfig *config,
+ gint multiplier);
#endif /* __LIBTRACKER_COMMON_UTILS_H__ */
Modified: branches/indexer-split/src/tracker-indexer/Makefile.am
==============================================================================
--- branches/indexer-split/src/tracker-indexer/Makefile.am (original)
+++ branches/indexer-split/src/tracker-indexer/Makefile.am Fri Aug 8 11:38:07 2008
@@ -32,7 +32,7 @@
tracker_indexer_LDADD = \
$(top_builddir)/src/libtracker-db/libtracker-db.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
- $(top_builddir)/src/libstemmer/libstemmer-private.la \
+ $(top_builddir)/src/libstemmer/libstemmer.la \
$(top_builddir)/src/xdgmime/libxdgmime.la \
$(trackerd_win_libs) \
$(DBUS_LIBS) \
Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer.c Fri Aug 8 11:38:07 2008
@@ -117,9 +117,7 @@
TrackerConfig *config;
TrackerLanguage *language;
-#ifdef HAVE_HAL
TrackerHal *hal;
-#endif /* HAVE_HAL */
GTimer *timer;
@@ -765,25 +763,6 @@
}
static void
-indexer_throttle (TrackerConfig *config,
- gint multiplier)
-{
- gint throttle;
-
- throttle = tracker_config_get_throttle (config);
-
- if (throttle < 1) {
- return;
- }
-
- throttle *= multiplier;
-
- if (throttle > 0) {
- g_usleep (throttle);
- }
-}
-
-static void
index_metadata_item (TrackerField *field,
const gchar *value,
MetadataForeachData *data)
@@ -832,7 +811,7 @@
/* Throttle indexer, value 9 is from older code, why 9? */
throttle = tracker_config_get_throttle (data->config);
if (throttle > 9) {
- indexer_throttle (data->config, throttle * 100);
+ tracker_throttle (data->config, throttle * 100);
}
if (!tracker_field_get_multiple_values (field)) {
@@ -1316,7 +1295,7 @@
indexer->private->current_module_name = g_strdup (info->file->module_name);
/* Sleep to throttle back indexing */
- indexer_throttle (indexer->private->config, 100);
+ tracker_throttle (indexer->private->config, 100);
metadata = tracker_indexer_module_file_get_metadata (info->module, info->file);
Modified: branches/indexer-split/src/tracker-indexer/tracker-main.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-main.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-main.c Fri Aug 8 11:38:07 2008
@@ -43,15 +43,15 @@
#include "tracker-indexer.h"
#include "tracker-indexer-db.h"
-#define ABOUT \
- "Tracker " VERSION "\n" \
+#define ABOUT \
+ "Tracker " VERSION "\n" \
"Copyright (c) 2005-2008 Jamie McCracken (jamiemcc gnome org)\n"
-#define LICENSE \
+#define LICENSE \
"This program is free software and comes without any warranty.\n" \
- "It is licensed under version 2 or later of the General Public " \
- "License which can be viewed at:\n" \
- "\n" \
+ "It is licensed under version 2 or later of the General Public " \
+ "License which can be viewed at:\n" \
+ "\n" \
" http://www.gnu.org/licenses/gpl.txt\n"
#define QUIT_TIMEOUT 10 /* Seconds */
Modified: branches/indexer-split/src/trackerd/Makefile.am
==============================================================================
--- branches/indexer-split/src/trackerd/Makefile.am (original)
+++ branches/indexer-split/src/trackerd/Makefile.am Fri Aug 8 11:38:07 2008
@@ -73,7 +73,7 @@
trackerd_LDADD = \
$(top_builddir)/src/libtracker-db/libtracker-db.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
- $(top_builddir)/src/libstemmer/libstemmer-private.la \
+ $(top_builddir)/src/libstemmer/libstemmer.la \
$(top_builddir)/src/xdgmime/libxdgmime.la \
$(GMIME_LIBS) \
$(FAM_LIBS) \
Modified: branches/indexer-split/src/trackerd/tracker-crawler.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-crawler.c (original)
+++ branches/indexer-split/src/trackerd/tracker-crawler.c Fri Aug 8 11:38:07 2008
@@ -52,7 +52,6 @@
struct _TrackerCrawlerPrivate {
TrackerConfig *config;
- TrackerHal *hal;
gchar *module_name;
@@ -422,6 +421,9 @@
return TRUE;
}
+ /* Make sure we throttle the processing */
+ tracker_throttle (priv->config, 100);
+
/* Crawler files */
file = g_queue_pop_head (priv->files);
Modified: branches/indexer-split/src/trackerd/tracker-main.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.c (original)
+++ branches/indexer-split/src/trackerd/tracker-main.c Fri Aug 8 11:38:07 2008
@@ -78,6 +78,10 @@
"\n" \
" http://www.gnu.org/licenses/gpl.txt\n"
+/* Throttle defaults */
+#define THROTTLE_DEFAULT 0
+#define THROTTLE_DEFAULT_ON_BATTERY 5
+
typedef enum {
TRACKER_RUNNING_NON_ALLOWED,
TRACKER_RUNNING_READ_ONLY,
@@ -289,6 +293,8 @@
g_message ("Daemon options:");
+ g_message (" Throttle level ....................... %d",
+ tracker_config_get_throttle (config));
g_message (" Indexing enabled ..................... %s",
tracker_config_get_enable_indexing (config) ? "yes" : "no");
g_message (" Monitoring enabled ................... %s",
@@ -514,6 +520,60 @@
}
}
+#ifdef HAVE_HAL
+
+static void
+set_up_throttle (TrackerHal *hal,
+ TrackerConfig *config)
+{
+ gint throttle;
+
+ /* If on a laptop battery and the throttling is default (i.e.
+ * 0), then set the throttle to be higher so we don't kill
+ * the laptop battery.
+ */
+ throttle = tracker_config_get_throttle (config);
+
+ if (tracker_hal_get_battery_in_use (hal)) {
+ g_message ("We are running on battery");
+
+ if (throttle == THROTTLE_DEFAULT) {
+ tracker_config_set_throttle (config,
+ THROTTLE_DEFAULT_ON_BATTERY);
+ g_message ("Setting throttle from %d to %d",
+ throttle,
+ THROTTLE_DEFAULT_ON_BATTERY);
+ } else {
+ g_message ("Not setting throttle, it is currently set to %d",
+ throttle);
+ }
+ } else {
+ g_message ("We are not running on battery");
+
+ if (throttle == THROTTLE_DEFAULT_ON_BATTERY) {
+ tracker_config_set_throttle (config,
+ THROTTLE_DEFAULT);
+ g_message ("Setting throttle from %d to %d",
+ throttle,
+ THROTTLE_DEFAULT);
+ } else {
+ g_message ("Not setting throttle, it is currently set to %d",
+ throttle);
+ }
+ }
+}
+
+static void
+notify_battery_in_use_cb (GObject *gobject,
+ GParamSpec *arg1,
+ gpointer user_data)
+{
+ set_up_throttle (TRACKER_HAL (gobject),
+ TRACKER_CONFIG (user_data));
+}
+
+#endif /* HAVE_HAL */
+
static gboolean
start_cb (gpointer user_data)
{
@@ -627,6 +687,12 @@
#ifdef HAVE_HAL
hal = tracker_hal_new ();
+
+ g_signal_connect (hal, "notify::battery-in-use",
+ G_CALLBACK (notify_battery_in_use_cb),
+ config);
+
+ set_up_throttle (hal, config);
#endif /* HAVE_HAL */
/* Daemon command line arguments */
@@ -817,6 +883,10 @@
tracker_log_shutdown ();
#ifdef HAVE_HAL
+ g_signal_handlers_disconnect_by_func (hal,
+ notify_battery_in_use_cb,
+ config);
+
g_object_unref (hal);
#endif /* HAVE_HAL */
Modified: branches/indexer-split/tests/libtracker-common/Makefile.am
==============================================================================
--- branches/indexer-split/tests/libtracker-common/Makefile.am (original)
+++ branches/indexer-split/tests/libtracker-common/Makefile.am Fri Aug 8 11:38:07 2008
@@ -71,7 +71,7 @@
$(top_builddir)/src/libtracker-common/libtracker-common.la \
$(top_builddir)/tests/common/libtracker-testcommon.la \
$(top_builddir)/src/xdgmime/libxdgmime.la \
- $(top_builddir)/src/libstemmer/libstemmer-private.la \
+ $(top_builddir)/src/libstemmer/libstemmer.la \
$(GMODULE_LIBS) \
$(GTHREAD_LIBS) \
$(GLIB2_LIBS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]