mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-20 03:02:36 +03:00
update content wallclock timing to use monotonic time interface
This commit is contained in:
parent
9177143266
commit
10ef7b3f1d
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <nsutils/time.h>
|
||||||
|
|
||||||
#include "utils/utils.h"
|
#include "utils/utils.h"
|
||||||
#include "utils/log.h"
|
#include "utils/log.h"
|
||||||
@ -96,7 +97,7 @@ nserror content__init(struct content *c, const content_handler *handler,
|
|||||||
c->available_width = 0;
|
c->available_width = 0;
|
||||||
c->quirks = quirks;
|
c->quirks = quirks;
|
||||||
c->refresh = 0;
|
c->refresh = 0;
|
||||||
c->time = wallclock();
|
nsu_getmonotonic_ms(&c->time);
|
||||||
c->size = 0;
|
c->size = 0;
|
||||||
c->title = NULL;
|
c->title = NULL;
|
||||||
c->active = 0;
|
c->active = 0;
|
||||||
@ -215,10 +216,9 @@ static void content_update_status(struct content *c)
|
|||||||
c->sub_status[0] != '\0' ? ", " : " ",
|
c->sub_status[0] != '\0' ? ", " : " ",
|
||||||
c->sub_status);
|
c->sub_status);
|
||||||
} else {
|
} else {
|
||||||
unsigned int time = c->time;
|
|
||||||
snprintf(c->status_message, sizeof (c->status_message),
|
snprintf(c->status_message, sizeof (c->status_message),
|
||||||
"%s (%.1fs)", messages_get("Done"),
|
"%s (%.1fs)", messages_get("Done"),
|
||||||
(float) time / 100);
|
(float) c->time / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,9 +311,12 @@ void content_set_ready(struct content *c)
|
|||||||
void content_set_done(struct content *c)
|
void content_set_done(struct content *c)
|
||||||
{
|
{
|
||||||
union content_msg_data msg_data;
|
union content_msg_data msg_data;
|
||||||
|
uint64_t now_ms;
|
||||||
|
|
||||||
|
nsu_getmonotonic_ms(&now_ms);
|
||||||
|
|
||||||
c->status = CONTENT_STATUS_DONE;
|
c->status = CONTENT_STATUS_DONE;
|
||||||
c->time = wallclock() - c->time;
|
c->time = now_ms - c->time;
|
||||||
content_update_status(c);
|
content_update_status(c);
|
||||||
content_broadcast(c, CONTENT_MSG_DONE, msg_data);
|
content_broadcast(c, CONTENT_MSG_DONE, msg_data);
|
||||||
}
|
}
|
||||||
|
@ -126,9 +126,10 @@ struct content {
|
|||||||
|
|
||||||
struct content_rfc5988_link *links; /**< list of metadata links */
|
struct content_rfc5988_link *links; /**< list of metadata links */
|
||||||
|
|
||||||
unsigned int time; /**< Creation time,
|
/** Creation timestamp when LOADING or READY.
|
||||||
if LOADING or READY,
|
* Total time in ms when DONE.
|
||||||
otherwise total time. */
|
*/
|
||||||
|
uint64_t time;
|
||||||
|
|
||||||
uint64_t reformat_time; /**< Earliest time to attempt a period
|
uint64_t reformat_time; /**< Earliest time to attempt a period
|
||||||
* reflow while fetching a page's objects.
|
* reflow while fetching a page's objects.
|
||||||
|
Loading…
Reference in New Issue
Block a user