Update scheduler logging to use catagory

This commit is contained in:
Vincent Sanders 2017-09-07 15:30:08 +01:00
parent b346790cf6
commit b9bdc279f2
9 changed files with 71 additions and 71 deletions

View File

@ -228,9 +228,11 @@ static void ami_schedule_dump(void)
while ((nscb = pblIteratorNext(iterator)) != -1)
{
Amiga2Date(nscb->tv.Seconds, &clockdata);
LOG("nscb: %p, at %d-%d-%d %d:%d:%d.%d, callback: %p, %p",
nscb, clockdata.mday, clockdata.month, clockdata.year, clockdata.hour, clockdata.min, clockdata.sec,
nscb->tv.Microseconds, nscb->callback, nscb->p);
NSLOG(netsurf, INFO,
"nscb: %p, at %d-%d-%d %d:%d:%d.%d, callback: %p, %p",
nscb, clockdata.mday, clockdata.month, clockdata.year,
clockdata.hour, clockdata.min, clockdata.sec,
nscb->tv.Microseconds, nscb->callback, nscb->p);
if(CheckIO((struct IORequest *)nscb) == NULL) {
NSLOG(netsurf, INFO, "-> ACTIVE");
} else {

View File

@ -23,15 +23,10 @@
#include "utils/sys_time.h"
#include "utils/errors.h"
#include "utils/log.h"
#include "atari/schedule.h"
#ifdef DEBUG_SCHEDULER
#include "utils/log.h"
#else
#define LOG(x...)
#endif
#define MS_NOW() ((clock() * 1000) / CLOCKS_PER_SEC)
/* linked list of scheduled callbacks */
@ -71,7 +66,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
return NSERROR_OK;
}
NSLOG(netsurf, INFO, "removing %p, %p", callback, p);
NSLOG(schedule, DEBUG, "removing %p, %p", callback, p);
cur_nscb = schedule_list;
prev_nscb = NULL;
@ -80,7 +75,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
if ((cur_nscb->callback == callback) &&
(cur_nscb->p == p)) {
/* item to remove */
NSLOG(netsurf, INFO,
NSLOG(schedule, DEBUG,
"callback entry %p removing %p(%p)", cur_nscb,
cur_nscb->callback, cur_nscb->p);
@ -120,7 +115,7 @@ nserror atari_schedule(int ival, void (*callback)(void *p), void *p)
nscb->timeout = MS_NOW() + ival;
NSLOG(netsurf, INFO, "adding callback %p for %p(%p) at %d ms", nscb,
NSLOG(schedule, DEBUG, "adding callback %p for %p(%p) at %d ms", nscb,
callback, p, nscb->timeout);
nscb->callback = callback;
@ -167,7 +162,7 @@ int schedule_run(void)
prev_nscb->next = unlnk_nscb->next;
}
NSLOG(netsurf, INFO,
NSLOG(schedule, DEBUG,
"callback entry %p running %p(%p)", unlnk_nscb,
unlnk_nscb->callback, unlnk_nscb->p);
@ -178,7 +173,7 @@ int schedule_run(void)
/* need to deal with callback modifying the list. */
if (schedule_list == NULL) {
NSLOG(netsurf, INFO, "schedule_list == NULL");
NSLOG(schedule, DEBUG, "schedule_list == NULL");
return -1; /* no more callbacks scheduled */
}
@ -203,7 +198,7 @@ int schedule_run(void)
/* make rettime relative to now and convert to ms */
nexttime = nexttime - now;
NSLOG(netsurf, INFO, "returning time to next event as %ldms",
NSLOG(schedule, DEBUG, "returning time to next event as %ldms",
nexttime);
/*return next event time in milliseconds (24days max wait) */
@ -216,15 +211,15 @@ void list_schedule(void)
{
struct nscallback *cur_nscb;
NSLOG(netsurf, INFO, "schedule list at ms clock %ld", MS_NOW());
NSLOG(schedule, DEBUG, "schedule list at ms clock %ld", MS_NOW());
cur_nscb = schedule_list;
while (cur_nscb != NULL) {
NSLOG(netsurf, INFO, "Schedule %p at %ld", cur_nscb,
NSLOG(schedule, DEBUG, "Schedule %p at %ld", cur_nscb,
cur_nscb->timeout);
cur_nscb = cur_nscb->next;
}
NSLOG(netsurf, INFO, "Maxmium callbacks scheduled: %d", max_scheduled);
NSLOG(schedule, DEBUG, "Maxmium callbacks scheduled: %d", max_scheduled);
}

View File

@ -28,11 +28,7 @@ extern "C" {
#include "netsurf/content_type.h"
#include "netsurf/browser_window.h"
#ifdef DEBUG_BEOS_SCHEDULE
#include "utils/log.h"
#else
#define LOG(x...)
#endif
}
/** Killable callback closure embodiment. */
@ -58,8 +54,10 @@ nsbeos_schedule_kill_callback(void *_target, void *_match)
_nsbeos_callback_t *match = (_nsbeos_callback_t *)_match;
if ((target->callback == match->callback) &&
(target->context == match->context)) {
NSLOG(netsurf, INFO, "Found match for %p(%p), killing.",
target->callback, target->context);
NSLOG(schedule, DEBUG,
"Found match for %p(%p), killing.",
target->callback,
target->context);
target->callback = NULL;
target->context = NULL;
target->callback_killed = true;
@ -70,7 +68,9 @@ nsbeos_schedule_kill_callback(void *_target, void *_match)
static void
schedule_remove(void (*callback)(void *p), void *p)
{
NSLOG(netsurf, INFO, "schedule_remove() for %p(%p)", cb->callback,
NSLOG(schedule, DEBUG,
"schedule_remove() for %p(%p)",
cb->callback,
cb->context);
if (callbacks == NULL)
return;
@ -83,7 +83,7 @@ schedule_remove(void (*callback)(void *p), void *p)
nserror beos_schedule(int t, void (*callback)(void *p), void *p)
{
NSLOG(netsurf, INFO, "t:%d cb:%p p:%p", t, cb->callback, cb->context);
NSLOG(schedule, DEBUG, "t:%d cb:%p p:%p", t, cb->callback, cb->context);
if (callbacks == NULL) {
callbacks = new BList;
@ -113,7 +113,7 @@ nserror beos_schedule(int t, void (*callback)(void *p), void *p)
bool
schedule_run(void)
{
NSLOG(netsurf, INFO, "schedule_run()");
NSLOG(schedule, DEBUG, "schedule_run()");
earliest_callback_timeout = B_INFINITE_TIMEOUT;
if (callbacks == NULL)
@ -122,7 +122,8 @@ schedule_run(void)
bigtime_t now = system_time();
int32 i;
NSLOG(netsurf, INFO, "Checking %ld callbacks to for deadline.",
NSLOG(schedule, DEBUG,
"Checking %ld callbacks to for deadline.",
this_run->CountItems());
/* Run all the callbacks which made it this far. */
@ -135,8 +136,11 @@ schedule_run(void)
i++;
continue;
}
NSLOG(netsurf, INFO, "Running callbacks %p(%p).",
cb->callback, cb->context);
NSLOG(schedule, DEBUG,
"Running callbacks %p(%p).",
cb->callback,
cb->context);
if (!cb->callback_killed)
cb->callback(cb->context);
callbacks->RemoveItem(cb);

View File

@ -24,12 +24,6 @@
#include "framebuffer/schedule.h"
#ifdef DEBUG_SCHEDULER
#define SRLOG(x...) LOG(x)
#else
#define SRLOG(x...) ((void) 0)
#endif
/* linked list of scheduled callbacks */
static struct nscallback *schedule_list = NULL;
@ -63,7 +57,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
return NSERROR_OK;
}
SRLOG("removing %p, %p", callback, p);
NSLOG(schedule, DEBUG, "removing %p, %p", callback, p);
cur_nscb = schedule_list;
prev_nscb = NULL;
@ -73,7 +67,8 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
(cur_nscb->p == p)) {
/* item to remove */
SRLOG("callback entry %p removing %p(%p)",
NSLOG(schedule, DEBUG,
"callback entry %p removing %p(%p)",
cur_nscb, cur_nscb->callback, cur_nscb->p);
/* remove callback */
@ -109,7 +104,7 @@ nserror framebuffer_schedule(int tival, void (*callback)(void *p), void *p)
return ret;
}
SRLOG("Adding %p(%p) in %d", callback, p, tival);
NSLOG(schedule, DEBUG, "Adding %p(%p) in %d", callback, p, tival);
tv.tv_sec = tival / 1000; /* miliseconds to seconds */
tv.tv_usec = (tival % 1000) * 1000; /* remainder to microseconds */
@ -190,7 +185,9 @@ int schedule_run(void)
/* make rettime relative to now */
timersub(&nexttime, &tv, &rettime);
SRLOG("returning time to next event as %ldms",(rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
NSLOG(schedule, DEBUG,
"returning time to next event as %ldms",
(rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
/* return next event time in milliseconds (24days max wait) */
return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);

View File

@ -46,7 +46,7 @@ nsgtk_schedule_generic_callback(gpointer data)
_nsgtk_callback_t *cb = (_nsgtk_callback_t *)(data);
if (cb->callback_killed) {
/* This callback instance has been killed. */
NSLOG(netsurf, DEBUG, "CB at %p already dead.", cb);
NSLOG(schedule, DEBUG, "CB at %p already dead.", cb);
}
queued_callbacks = g_list_remove(queued_callbacks, cb);
pending_callbacks = g_list_append(pending_callbacks, cb);
@ -60,7 +60,8 @@ nsgtk_schedule_kill_callback(void *_target, void *_match)
_nsgtk_callback_t *match = (_nsgtk_callback_t *)_match;
if ((target->callback == match->callback) &&
(target->context == match->context)) {
NSLOG(netsurf, DEBUG, "Found match for %p(%p), killing.",
NSLOG(schedule, DEBUG,
"Found match for %p(%p), killing.",
target->callback, target->context);
target->callback = NULL;
target->context = NULL;
@ -119,7 +120,8 @@ schedule_run(void)
/* Clear the pending list. */
pending_callbacks = NULL;
NSLOG(netsurf, DEBUG, "Captured a run of %d callbacks to fire.",
NSLOG(schedule, DEBUG,
"Captured a run of %d callbacks to fire.",
g_list_length(this_run));
/* Run all the callbacks which made it this far. */

View File

@ -24,12 +24,6 @@
#include "monkey/schedule.h"
#ifdef DEBUG_SCHEDULER
#define SRLOG(x...) LOG(x)
#else
#define SRLOG(x...) ((void) 0)
#endif
/* linked list of scheduled callbacks */
static struct nscallback *schedule_list = NULL;
@ -63,7 +57,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
return NSERROR_OK;
}
SRLOG("removing %p, %p", callback, p);
NSLOG(schedule, DEBUG, "removing %p, %p", callback, p);
cur_nscb = schedule_list;
prev_nscb = NULL;
@ -73,7 +67,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
(cur_nscb->p == p)) {
/* item to remove */
SRLOG("callback entry %p removing %p(%p)",
NSLOG(schedule, DEBUG, "callback entry %p removing %p(%p)",
cur_nscb, cur_nscb->callback, cur_nscb->p);
/* remove callback */
@ -109,7 +103,7 @@ nserror monkey_schedule(int tival, void (*callback)(void *p), void *p)
return ret;
}
SRLOG("Adding %p(%p) in %d", callback, p, tival);
NSLOG(schedule, DEBUG, "Adding %p(%p) in %d", callback, p, tival);
tv.tv_sec = tival / 1000; /* miliseconds to seconds */
tv.tv_usec = (tival % 1000) * 1000; /* remainder to microseconds */
@ -190,7 +184,7 @@ int monkey_schedule_run(void)
/* make rettime relative to now */
timersub(&nexttime, &tv, &rettime);
SRLOG("returning time to next event as %ldms",
NSLOG(schedule, DEBUG, "returning time to next event as %ldms",
(rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
/* return next event time in milliseconds (24days max wait) */

View File

@ -25,12 +25,6 @@
#include "windows/schedule.h"
#ifdef DEBUG_SCHEDULER
#define SRLOG(x...) LOG(x)
#else
#define SRLOG(x...) ((void) 0)
#endif
/* linked list of scheduled callbacks */
static struct nscallback *schedule_list = NULL;
@ -66,7 +60,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
return NSERROR_OK;
}
SRLOG("removing %p, %p", callback, p);
NSLOG(schedule, DEBUG, "removing %p, %p", callback, p);
cur_nscb = schedule_list;
prev_nscb = NULL;
@ -76,8 +70,11 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
(cur_nscb->p == p)) {
/* item to remove */
SRLOG("callback entry %p removing %p(%p)",
cur_nscb, cur_nscb->callback, cur_nscb->p);
NSLOG(schedule, DEBUG,
"callback entry %p removing %p(%p)",
cur_nscb,
cur_nscb->callback,
cur_nscb->p);
/* remove callback */
unlnk_nscb = cur_nscb;
@ -118,7 +115,8 @@ nserror win32_schedule(int ival, void (*callback)(void *p), void *p)
return NSERROR_NOMEM;
}
SRLOG("adding callback %p for %p(%p) at %d cs",
NSLOG(schedule, DEBUG,
"adding callback %p for %p(%p) at %d cs",
nscb, callback, p, ival);
gettimeofday(&nscb->tv, NULL);
@ -168,8 +166,11 @@ schedule_run(void)
prev_nscb->next = unlnk_nscb->next;
}
SRLOG("callback entry %p running %p(%p)",
unlnk_nscb, unlnk_nscb->callback, unlnk_nscb->p);
NSLOG(schedule, DEBUG,
"callback entry %p running %p(%p)",
unlnk_nscb,
unlnk_nscb->callback,
unlnk_nscb->p);
/* call callback */
unlnk_nscb->callback(unlnk_nscb->p);
@ -201,8 +202,9 @@ schedule_run(void)
/* make returned time relative to now */
timersub(&nexttime, &tv, &rettime);
SRLOG("returning time to next event as %ldms",
(rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
NSLOG(schedule, DEBUG,
"returning time to next event as %ldms",
(rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
/* return next event time in milliseconds (24days max wait) */
return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);
@ -216,14 +218,16 @@ void list_schedule(void)
gettimeofday(&tv, NULL);
NSLOG(netsurf, INFO, "schedule list at %ld:%ld", tv.tv_sec,
tv.tv_usec);
NSLOG(netsurf, INFO, "schedule list at %ld:%ld", tv.tv_sec, tv.tv_usec);
cur_nscb = schedule_list;
while (cur_nscb != NULL) {
NSLOG(netsurf, INFO, "Schedule %p at %ld:%ld", cur_nscb,
cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec);
NSLOG(netsurf, INFO,
"Schedule %p at %ld:%ld",
cur_nscb,
cur_nscb->tv.tv_sec,
cur_nscb->tv.tv_usec);
cur_nscb = cur_nscb->next;
}
}

View File

@ -95,6 +95,7 @@ NSLOG_DEFINE_CATEGORY(netsurf, "NetSurf default logging");
NSLOG_DEFINE_CATEGORY(llcache, "Low level cache");
NSLOG_DEFINE_CATEGORY(fetch, "objet fetching");
NSLOG_DEFINE_CATEGORY(plot, "rendering system");
NSLOG_DEFINE_CATEGORY(schedule, "scheduler");
static void
netsurf_render_log(void *_ctx,

View File

@ -60,6 +60,7 @@ NSLOG_DECLARE_CATEGORY(netsurf);
NSLOG_DECLARE_CATEGORY(llcache);
NSLOG_DECLARE_CATEGORY(fetch);
NSLOG_DECLARE_CATEGORY(plot);
NSLOG_DECLARE_CATEGORY(schedule);
#else /* WITH_NSLOG */