Tuesday, 25 November 2014

Re: netsurf: branch master updated. release/3.2-493-g81417ae

On Tue, Nov 25, 2014 at 11:14:28PM +0000, NetSurf Browser Project wrote:
>
> - Log -----------------------------------------------------------------
> commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=81417ae4a5a58ef75ac4113ea2b2d8c72474ea97
> commit 81417ae4a5a58ef75ac4113ea2b2d8c72474ea97
> Author: Vincent Sanders <vince@kyllikki.org>
> Commit: Vincent Sanders <vince@kyllikki.org>
>
> caclulate the total amount of time spent writing an object out

[...]

> +write_backing_store(struct llcache_object *object, size_t *written_out, unsigned long *elapsed)

[...]

> + gettimeofday(&start_tv, NULL);

[...]

> + gettimeofday(&end_tv, NULL);
> +
> + timersub(&end_tv, &start_tv, &elapsed_tv);
> +
> object->store_state = LLCACHE_STATE_DISC;
>
> *written_out = object->source_len + metadatasize;
>
> + *elapsed = (elapsed_tv.tv_sec * 1000) + (elapsed_tv.tv_usec / 1000);
> +

This doesn't cope with time going backwards during the write out
operation (as gettimeofday is affected by NTP, amongst other things).
The upshot will be that the computed elapsed time comes out as a large
unsigned value (time_t is signed on most systems), and thus we'll decide
that write bandwidth is non-existent.

Ideally, we'd have a way to read the value of the monotonic timer on the
system. That's platform-specific, however, so a fairly invasive change.
Is there a better way of dealing with this?


J.

No comments:

Post a Comment