Logged In: YES
user_id=1011928
Originator: NO

The effect of the log messages will be less on systems running in laptop mode, which by default lets dirty data accumulate for up to 10 minutes before being written to disk.

Just for fun, I wrote two patches that might at least quieten the log messages. I guess you will probably have to view the source to get them unadulterated because I don't have permission to attach them.

The first is seemingly inconsequential and just changes the log level to "info". If you want debug level you could more simply change the existing g_message() calls to g_debug() and ignore this patch.
----
Log at INFO level instead of MESSAGE

diff --git a/src/prophet.c b/src/prophet.c
index ed4a638..c6c365e 100644
--- a/src/prophet.c
+++ b/src/prophet.c
@@ -215,11 +215,12 @@ preload_prophet_readahead (GPtrArray *maps_arr)
map_prob_print (map);
}

- g_message ("%dkb available for preloading, using %dkb of it",
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
+ "%dkb available for preloading, using %dkb of it",
memavailtotal, memavailtotal - memavail);

if (i) {
- g_message ("readaheading %d files", i);
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "readaheading %d files", i);
preload_readahead ((preload_map_t **)maps_arr->pdata, i);
}
}

The second one is more interesting, it only logs a message if the number of files changes or if the amount of memory available/used changes by more than 10%. In the 15 minutes since I wrote the code there have only been 3 messages logged (not including the initial two at daemon startup) - sure my machine is not doing much, but I guess if it was doing something then there's a good chance it would have hit the disk for the other tasks anyway.
----
Only log messages when there is a significant change

Where significant is defined as a 10% change in the number of files or
amount of memory.

diff --git a/src/prophet.c b/src/prophet.c
index c6c365e..0be33b9 100644
--- a/src/prophet.c
+++ b/src/prophet.c
@@ -180,13 +180,32 @@ map_prob_print (preload_map_t *map)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define kb(v) ((int)(((v) + 1023) / 1024))

+static gboolean G_GNUC_CONST
+is_notable_change (int memavail, int last_memavail,
+ int memavailtotal, int last_memavailtotal)
+{
+ /* a 10% change is notable */
+ const double NOTABLE_INCREASE = 1.1;
+ const double NOTABLE_DECREASE = 0.9;
+
+ if (memavail > last_memavail * NOTABLE_INCREASE ||
+ memavail < last_memavail * NOTABLE_DECREASE ||
+ memavailtotal > last_memavailtotal * NOTABLE_INCREASE ||
+ memavailtotal < last_memavailtotal * NOTABLE_DECREASE)
+ return TRUE;
+
+ return FALSE;
+}
+
/* input is the list of maps sorted on the need.
* decide a cutoff based on memory conditions and readhead. */
void
preload_prophet_readahead (GPtrArray *maps_arr)
{
- int i;
+ int numfiles;
int memavail, memavailtotal; /* in kilobytes */
+ static int last_numfiles = 0;
+ static int last_memavail = 0, last_memavailtotal = 0;
preload_memory_t memstat;
preload_map_t *map;

@@ -203,11 +222,11 @@ preload_prophet_readahead (GPtrArray *maps_arr)
memcpy (&(state->memstat), &memstat, sizeof (memstat));
state->memstat_timestamp = state->time;

- i = 0;
- while (i < (int)(maps_arr->len) &&
- (map = g_ptr_array_index (maps_arr, i)) &&
+ numfiles = 0;
+ while (numfiles < (int)(maps_arr->len) &&
+ (map = g_ptr_array_index (maps_arr, numfiles)) &&
map->lnprob < 0 && kb (map->length) <= memavail) {
- i++;
+ numfiles++;

memavail -= kb (map->length);

@@ -215,13 +234,20 @@ preload_prophet_readahead (GPtrArray *maps_arr)
map_prob_print (map);
}

- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
- "%dkb available for preloading, using %dkb of it",
- memavailtotal, memavailtotal - memavail);
+ if (is_notable_change(memavail, last_memavail, memavailtotal,
+ last_memavailtotal)) {
+ last_memavail = memavail;
+ last_memavailtotal = memavailtotal;
+
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
+ "%dkb available for preloading, using %dkb of it",
+ memavailtotal, memavailtotal - memavail);
+ }

- if (i) {
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "readaheading %d files", i);
- preload_readahead ((preload_map_t **)maps_arr->pdata, i);
+ if (numfiles && numfiles != last_numfiles) {
+ last_numfiles = numfiles;
+ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "readaheading %d files", numfiles);
+ preload_readahead ((preload_map_t **)maps_arr->pdata, numfiles);
}
}