diff options
author | Yorhel <git@yorhel.nl> | 2013-06-09 09:17:02 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2013-06-09 09:21:59 +0200 |
commit | 0fcec90516b6b8da9e128f39b15f53a139e05b4f (patch) | |
tree | 6785281e4e35f634cf2177c41f8e8fd0241f3699 | |
parent | 2daee645811d3c918bc9a14369909c457d39a3b9 (diff) |
share/scan: Log scanning time
A quick benchmark indicates that Globster scans a little more than twice
as slow as 'ncdu -q0o- >/dev/null'. I haven't looked at where the
overhead goes to exactly (I do have several ideas), but I suppose it's
fast enough for now. Scanning 30k files/dirs in 0.2s isn't so bad,
after all; More than fast enough to have disk I/O as the bottleneck in
the majority of cases.
-rw-r--r-- | src/share/scan.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/share/scan.c b/src/share/scan.c index eb99dc0..c39d5af 100644 --- a/src/share/scan.c +++ b/src/share/scan.c @@ -99,6 +99,7 @@ typedef struct { struct share_scan_t { + ev_tstamp start; share_t *s; share_fl_t *root, *dir; share_scan_work_t **work, **next; @@ -438,13 +439,27 @@ static void share_scan_next(share_scan_t *sc) { } /* Nothing found, we're done. */ + if(ylog_enabled(YLOG_DEBUG)) { + kstring_t buf = {}; + share_fl_path(sc->root, &buf); + yinfo("Filesystem scan completed in %.3fs for share %"PRIu16" vpath '%s'", ev_now()-sc->start, sc->s->id, buf.s); + free(buf.s); + } free(sc); } share_scan_t *share_scan(share_t *s, share_fl_t *root) { + if(ylog_enabled(YLOG_DEBUG)) { + kstring_t buf = {}; + share_fl_path(root, &buf); + ydebug("Starting filesystem scan for share %"PRIu16" vpath '%s'", s->id, buf.s); + free(buf.s); + } + share_scan_t *sc = malloc(sizeof(share_scan_t)); sc->s = s; + sc->start = ev_now(); sc->root = sc->dir = root; share_scan_dir(sc); return sc; |