summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
71bd250)
It's nice to let the user know that something is happening.
#include <string.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <errno.h>
#include <time.h>
GIOChannel *channel;
GIOStatus gio_status;
GError *error = NULL;
GIOChannel *channel;
GIOStatus gio_status;
GError *error = NULL;
+ int count;
+ struct timeval tv_start, tv_now;
if (argc < 2) {
usage (argv[0]);
if (argc < 2) {
usage (argv[0]);
channel = g_io_channel_unix_new (fileno (stdin));
channel = g_io_channel_unix_new (fileno (stdin));
+ count = 0;
+
+ gettimeofday (&tv_start, NULL);
+
while (1) {
gio_status = g_io_channel_read_line (channel, &filename,
NULL, NULL, &error);
while (1) {
gio_status = g_io_channel_read_line (channel, &filename,
NULL, NULL, &error);
index_file (db, term_gen, filename);
g_free (filename);
index_file (db, term_gen, filename);
g_free (filename);
+
+ count++;
+ if (count % 250 == 0) {
+ gettimeofday (&tv_now, NULL);
+ printf ("Indexed %d messages (%g messages/second)\n",
+ count, count / ((tv_now.tv_sec - tv_start.tv_sec) +
+ (tv_now.tv_usec - tv_start.tv_usec) / 1e6));
+ }
}
} catch (const Xapian::Error &error) {
}
} catch (const Xapian::Error &error) {