[tracker/tracker-0.10] tracker-extract,pdf: Improve logging
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10] tracker-extract,pdf: Improve logging
- Date: Wed, 2 Mar 2011 15:33:19 +0000 (UTC)
commit d75c5d707290a572eb2bb4614c15f095616161c7
Author: Aleksander Morgado <aleksander lanedo com>
Date: Tue Feb 22 15:08:33 2011 +0100
tracker-extract,pdf: Improve logging
src/tracker-extract/tracker-extract-pdf.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 9de3b3c..673b51f 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -189,13 +189,14 @@ extract_content (PopplerDocument *document,
gint n_pages, i = 0;
GString *string;
GTimer *timer;
+ gsize remaining_bytes = n_bytes;
n_pages = poppler_document_get_n_pages (document);
string = g_string_new ("");
timer = g_timer_new ();
while (i < n_pages &&
- n_bytes > 0 &&
+ remaining_bytes > 0 &&
g_timer_elapsed (timer, NULL) < 5) {
PopplerPage *page;
gsize written_bytes;
@@ -212,18 +213,26 @@ extract_content (PopplerDocument *document,
}
if (tracker_text_validate_utf8 (text,
- MIN (strlen (text), n_bytes),
+ MIN (strlen (text), remaining_bytes),
&string,
&written_bytes)) {
g_string_append_c (string, ' ');
}
- n_bytes -= written_bytes;
+ remaining_bytes -= written_bytes;
+
+ g_debug ("Extracted %" G_GSIZE_FORMAT " bytes from page %d, "
+ "%" G_GSIZE_FORMAT " bytes remaining",
+ written_bytes, i, remaining_bytes);
g_free (text);
g_object_unref (page);
}
+ g_debug ("Content extraction finished: %d/%d pages indexed in %lf seconds, "
+ "%" G_GSIZE_FORMAT " bytes extracted",
+ i, n_pages, g_timer_elapsed (timer, NULL), (n_bytes - remaining_bytes));
+
g_timer_destroy (timer);
return g_string_free (string, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]