WIP: deploy new logging flags in lib
This commit is contained in:
parent
9aefc2e971
commit
b9fc2d6522
12 changed files with 71 additions and 49 deletions
|
|
@ -189,11 +189,11 @@ namespace lib {
|
|||
}
|
||||
catch (lumiera::Error & ex)
|
||||
{
|
||||
WARN (operate, "Exception while closing AllocationCluster: %s",ex.what());
|
||||
WARN (progress, "Exception while closing AllocationCluster: %s", ex.what());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
ERROR (NOBUG_ON, "Unexpected fatal Exception while closing AllocationCluster.");
|
||||
ALERT (progress, "Unexpected fatal Exception while closing AllocationCluster.");
|
||||
lumiera::error::lumiera_unexpectedException(); // terminate
|
||||
}
|
||||
}
|
||||
|
|
@ -243,3 +243,11 @@ namespace lib {
|
|||
|
||||
|
||||
} // namespace lib
|
||||
|
||||
/*
|
||||
// Local Variables:
|
||||
// mode: C
|
||||
// c-file-style: "gnu"
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "lib/cmdline.hpp"
|
||||
#include "lib/util.hpp"
|
||||
#include "include/nobugcfg.h"
|
||||
#include "common/logging.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#define LUMIERA_ERROR_HPP_
|
||||
|
||||
#include <string>
|
||||
#include "include/nobugcfg.h"
|
||||
#include "common/logging.h"
|
||||
#include "include/lifecycle.h"
|
||||
#include "lib/error.h"
|
||||
|
||||
|
|
@ -165,6 +165,7 @@ namespace lumiera {
|
|||
* if NoBug is used, redefine some macros
|
||||
* to rather throw Lumiera Errors instead of aborting
|
||||
*/
|
||||
#if 0 /*This will not work, nobug aborts are hard and may hold some locks, we discussed that before -- cehteh */
|
||||
#ifdef NOBUG_ABORT
|
||||
#undef NOBUG_ABORT
|
||||
#define LUMIERA_NOBUG_LOCATION \
|
||||
|
|
@ -172,6 +173,6 @@ namespace lumiera {
|
|||
#define NOBUG_ABORT \
|
||||
lumiera::error::assertion_terminate (LUMIERA_NOBUG_LOCATION);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif // LUMIERA_ERROR_HPP_
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "common/logging.h"
|
||||
#include "lib/psplay.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -28,7 +29,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <nobug.h>
|
||||
|
||||
NOBUG_DEFINE_FLAG (psplay);
|
||||
//NOBUG_DEFINE_FLAG (psplay);
|
||||
|
||||
#ifndef PSPLAY_TRAIL_DEPTH
|
||||
#define PSPLAY_TRAIL_DEPTH 128
|
||||
|
|
@ -68,8 +69,8 @@ static inline uint32_t psplay_fast_prng ()
|
|||
PSplay
|
||||
psplay_init (PSplay self, psplay_cmp_fn cmp, psplay_key_fn key, psplay_delete_fn del)
|
||||
{
|
||||
NOBUG_INIT_FLAG (psplay);
|
||||
TRACE (psplay);
|
||||
//NOBUG_INIT_FLAG (psplay);
|
||||
TRACE (psplay_dbg);
|
||||
REQUIRE (cmp);
|
||||
REQUIRE (key);
|
||||
|
||||
|
|
@ -103,7 +104,7 @@ psplay_new (psplay_cmp_fn cmp, psplay_key_fn key, psplay_delete_fn del)
|
|||
PSplay
|
||||
psplay_destroy (PSplay self)
|
||||
{
|
||||
TRACE (psplay);
|
||||
TRACE (psplay_dbg);
|
||||
if (self) while (self->tree)
|
||||
{
|
||||
PSplaynode n = psplay_remove (self, self->tree);
|
||||
|
|
@ -159,7 +160,7 @@ trailidx (unsigned n)
|
|||
static inline void
|
||||
psplay_splay (PSplay self, struct psplaytrail* trail, unsigned splayfactor)
|
||||
{
|
||||
TRACE (psplay, "%p %u", self, splayfactor);
|
||||
TRACE (psplay_dbg, "%p %u", self, splayfactor);
|
||||
|
||||
if (trail->dir < 0) trail->dir = - trail->dir;
|
||||
|
||||
|
|
@ -170,17 +171,17 @@ psplay_splay (PSplay self, struct psplaytrail* trail, unsigned splayfactor)
|
|||
PSplaynode grandparent = *trail->trail [trailidx (depth-2)];
|
||||
|
||||
unsigned r = PSPLAY_FORMULA;
|
||||
TRACE (psplay, "r is %u", r);
|
||||
TRACE (psplay_dbg, "r is %u", r);
|
||||
|
||||
if (parent == grandparent->left)
|
||||
{
|
||||
TRACE (psplay, "ZIG..");
|
||||
TRACE (psplay_dbg, "ZIG..");
|
||||
if (node == parent->left)
|
||||
{
|
||||
TRACE (psplay, "..ZIG");
|
||||
TRACE (psplay_dbg, "..ZIG");
|
||||
if (r < PSPLAY_PROB_ZIGZIG)
|
||||
{
|
||||
TRACE (psplay, "BREAK");
|
||||
TRACE (psplay_dbg, "BREAK");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -192,10 +193,10 @@ psplay_splay (PSplay self, struct psplaytrail* trail, unsigned splayfactor)
|
|||
}
|
||||
else
|
||||
{
|
||||
TRACE (psplay, "..ZAG");
|
||||
TRACE (psplay_dbg, "..ZAG");
|
||||
if (r < PSPLAY_PROB_ZIGZAG)
|
||||
{
|
||||
TRACE (psplay, "BREAK");
|
||||
TRACE (psplay_dbg, "BREAK");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -208,13 +209,13 @@ psplay_splay (PSplay self, struct psplaytrail* trail, unsigned splayfactor)
|
|||
}
|
||||
else
|
||||
{
|
||||
TRACE (psplay, "ZAG..");
|
||||
TRACE (psplay_dbg, "ZAG..");
|
||||
if (node == parent->left)
|
||||
{
|
||||
TRACE (psplay, "..ZIG");
|
||||
TRACE (psplay_dbg, "..ZIG");
|
||||
if (r < PSPLAY_PROB_ZIGZAG)
|
||||
{
|
||||
TRACE (psplay, "BREAK");
|
||||
TRACE (psplay_dbg, "BREAK");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -226,10 +227,10 @@ psplay_splay (PSplay self, struct psplaytrail* trail, unsigned splayfactor)
|
|||
}
|
||||
else
|
||||
{
|
||||
TRACE (psplay, "..ZAG");
|
||||
TRACE (psplay_dbg, "..ZAG");
|
||||
if (r < PSPLAY_PROB_ZIGZIG)
|
||||
{
|
||||
TRACE (psplay, "BREAK");
|
||||
TRACE (psplay_dbg, "BREAK");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +249,7 @@ psplay_splay (PSplay self, struct psplaytrail* trail, unsigned splayfactor)
|
|||
PSplaynode
|
||||
psplay_insert (PSplay self, PSplaynode node, int splayfactor)
|
||||
{
|
||||
TRACE (psplay);
|
||||
TRACE (psplay_dbg);
|
||||
PSplaynode n = self->tree;
|
||||
struct psplaytrail trail;
|
||||
|
||||
|
|
@ -301,7 +302,7 @@ psplay_insert (PSplay self, PSplaynode node, int splayfactor)
|
|||
PSplaynode
|
||||
psplay_find (PSplay self, const void* key, int splayfactor)
|
||||
{
|
||||
TRACE (psplay);
|
||||
TRACE (psplay_dbg);
|
||||
PSplaynode node = self->tree;
|
||||
struct psplaytrail trail;
|
||||
trail.dir = 0;
|
||||
|
|
@ -341,7 +342,7 @@ psplay_find (PSplay self, const void* key, int splayfactor)
|
|||
PSplaynode
|
||||
psplay_remove (PSplay self, PSplaynode node)
|
||||
{
|
||||
TRACE (psplay);
|
||||
TRACE (psplay_dbg);
|
||||
if (!node) return NULL;
|
||||
|
||||
PSplaynode* r = self->found_parent;
|
||||
|
|
@ -350,7 +351,7 @@ psplay_remove (PSplay self, PSplaynode node)
|
|||
{
|
||||
if (!psplay_find (self, self->key (node), 0))
|
||||
{
|
||||
WARN (psplay, "node %p is not in splay tree %p", node, self);
|
||||
WARN (psplay_dbg, "node %p is not in splay tree %p", node, self);
|
||||
return NULL;
|
||||
}
|
||||
r = self->found_parent;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "lib/query.hpp"
|
||||
#include "lib/util.hpp"
|
||||
#include "include/nobugcfg.h"
|
||||
#include "common/logging.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "common/logging.h"
|
||||
#include "lib/llist.h"
|
||||
#include "lib/mutex.h"
|
||||
#include "lib/safeclib.h"
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
NOBUG_DEFINE_FLAG (resourcecollector); /* TODO: make this a hierachy, derrive from PARENT (library) ? */
|
||||
//NOBUG_DEFINE_FLAG (resourcecollector); /* TODO: make this a hierachy, derrive from PARENT (library) ? */
|
||||
|
||||
llist lumiera_resourcecollector_registry[LUMIERA_RESOURCE_END];
|
||||
lumiera_mutex lumiera_resourcecollector_lock;
|
||||
|
|
@ -44,13 +45,13 @@ struct lumiera_resourcehandler_struct
|
|||
static void
|
||||
lumiera_resourcecollector_init_ (void)
|
||||
{
|
||||
NOBUG_INIT_FLAG (resourcecollector);
|
||||
TRACE (resourcecollector);
|
||||
//NOBUG_INIT_FLAG (resourcecollector);
|
||||
TRACE (resourcecollector_dbg);
|
||||
|
||||
for (int i = 0; i < LUMIERA_RESOURCE_END; ++i)
|
||||
llist_init (&lumiera_resourcecollector_registry[i]);
|
||||
|
||||
lumiera_mutex_init (&lumiera_resourcecollector_lock, "resourcecollector", &NOBUG_FLAG(resourcecollector));
|
||||
lumiera_mutex_init (&lumiera_resourcecollector_lock, "resourcecollector", &NOBUG_FLAG(mutex_dbg));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -58,25 +59,25 @@ lumiera_resourcecollector_init_ (void)
|
|||
void
|
||||
lumiera_resourcecollector_destroy (void)
|
||||
{
|
||||
TRACE (resourcecollector);
|
||||
TRACE (resourcecollector_dbg);
|
||||
|
||||
for (int i = 0; i < LUMIERA_RESOURCE_END; ++i)
|
||||
LLIST_WHILE_HEAD (&lumiera_resourcecollector_registry[i], head)
|
||||
lumiera_resourcehandler_unregister ((LumieraResourcehandler)head);
|
||||
|
||||
lumiera_mutex_destroy (&lumiera_resourcecollector_lock, &NOBUG_FLAG(resourcecollector));
|
||||
lumiera_mutex_destroy (&lumiera_resourcecollector_lock, &NOBUG_FLAG(mutex_dbg));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
lumiera_resourcecollector_run (enum lumiera_resource which, enum lumiera_resource_try* iteration, void* context)
|
||||
{
|
||||
TRACE (resourcecollector);
|
||||
TRACE (resourcecollector_dbg);
|
||||
|
||||
if (lumiera_resourcecollector_once == PTHREAD_ONCE_INIT)
|
||||
pthread_once (&lumiera_resourcecollector_once, lumiera_resourcecollector_init_);
|
||||
|
||||
LUMIERA_MUTEX_SECTION (resourcecollector, &lumiera_resourcecollector_lock)
|
||||
LUMIERA_MUTEX_SECTION (mutex_sync, &lumiera_resourcecollector_lock)
|
||||
{
|
||||
for (enum lumiera_resource_try progress = LUMIERA_RESOURCE_NONE; progress < *iteration; ++*iteration)
|
||||
{
|
||||
|
|
@ -99,7 +100,7 @@ lumiera_resourcecollector_run (enum lumiera_resource which, enum lumiera_resourc
|
|||
}
|
||||
else
|
||||
{
|
||||
ERROR (resourcecollector, "PANIC, Not enough resources %d", which);
|
||||
ALERT (resourcecollector, "PANIC, Not enough resources %d", which);
|
||||
for (int i = 0; i < LUMIERA_RESOURCE_END; ++i)
|
||||
LLIST_FOREACH (&lumiera_resourcecollector_registry[i], node)
|
||||
{
|
||||
|
|
@ -122,7 +123,7 @@ lumiera_resourcecollector_register_handler (enum lumiera_resource resource, lumi
|
|||
if (lumiera_resourcecollector_once == PTHREAD_ONCE_INIT)
|
||||
pthread_once (&lumiera_resourcecollector_once, lumiera_resourcecollector_init_);
|
||||
|
||||
TRACE (resourcecollector);
|
||||
TRACE (resourcecollector_dbg);
|
||||
|
||||
LumieraResourcehandler self = lumiera_malloc (sizeof (*self));
|
||||
|
||||
|
|
@ -130,7 +131,7 @@ lumiera_resourcecollector_register_handler (enum lumiera_resource resource, lumi
|
|||
self->handler = handler;
|
||||
self->data = data;
|
||||
|
||||
LUMIERA_MUTEX_SECTION (resourcecollector, &lumiera_resourcecollector_lock)
|
||||
LUMIERA_MUTEX_SECTION (mutex_sync, &lumiera_resourcecollector_lock)
|
||||
{
|
||||
llist_insert_tail (&lumiera_resourcecollector_registry[resource], &self->node);
|
||||
}
|
||||
|
|
@ -142,11 +143,11 @@ lumiera_resourcecollector_register_handler (enum lumiera_resource resource, lumi
|
|||
void
|
||||
lumiera_resourcehandler_unregister (LumieraResourcehandler self)
|
||||
{
|
||||
TRACE (resourcecollector);
|
||||
TRACE (resourcecollector_dbg);
|
||||
|
||||
if (self)
|
||||
{
|
||||
LUMIERA_MUTEX_SECTION (resourcecollector, &lumiera_resourcecollector_lock)
|
||||
LUMIERA_MUTEX_SECTION (mutex_sync, &lumiera_resourcecollector_lock)
|
||||
{
|
||||
llist_unlink (&self->node);
|
||||
self->handler (LUMIERA_RESOURCE_UNREGISTER, self->data, NULL);
|
||||
|
|
@ -160,10 +161,10 @@ lumiera_resourcehandler_unregister (LumieraResourcehandler self)
|
|||
LumieraResourcehandler
|
||||
lumiera_resourcecollector_handler_find (enum lumiera_resource resource, lumiera_resource_handler_fn handler, void* data)
|
||||
{
|
||||
TRACE (resourcecollector);
|
||||
TRACE (resourcecollector_dbg);
|
||||
LumieraResourcehandler self = NULL;
|
||||
|
||||
LUMIERA_MUTEX_SECTION (resourcecollector, &lumiera_resourcecollector_lock)
|
||||
LUMIERA_MUTEX_SECTION (mutex_sync, &lumiera_resourcecollector_lock)
|
||||
{
|
||||
LLIST_FOREACH (&lumiera_resourcecollector_registry[resource], node)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <nobug.h>
|
||||
|
||||
NOBUG_DECLARE_FLAG (resourcecollector);
|
||||
//NOBUG_DECLARE_FLAG (resourcecollector);
|
||||
|
||||
/**
|
||||
* Resources known to the resource collector
|
||||
|
|
|
|||
|
|
@ -37,12 +37,10 @@ This code is heavily inspired by
|
|||
|
||||
#include "lib/singletonpolicies.hpp" // several Policies usable together with SingletonFactory
|
||||
|
||||
#include "include/nobugcfg.h"
|
||||
#include "common/logging.h"
|
||||
#include "lib/util.hpp"
|
||||
#include "lib/sync-classlock.hpp"
|
||||
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
|
||||
/**
|
||||
|
|
@ -72,6 +70,7 @@ namespace lumiera {
|
|||
|
||||
static PType pInstance_;
|
||||
static bool isDead_;
|
||||
|
||||
|
||||
public:
|
||||
/** Interface to be used by SingletonFactory's clients.
|
||||
|
|
@ -83,7 +82,12 @@ namespace lumiera {
|
|||
{
|
||||
if (!pInstance_)
|
||||
{
|
||||
NOBUG_INIT;
|
||||
FIXME ("NoBug wasnt even basically initialized here, the old ON_BASIC_INIT did not initialize it in proper order"
|
||||
" so I explicitly init it here (calling init multiple times does not harm) --cehteh"
|
||||
" nb maybe as exception we can use an explicit mutex here since pthread mutexes can be statically initialized");
|
||||
ThreadLock guard SIDEEFFECT;
|
||||
|
||||
if (!pInstance_)
|
||||
{
|
||||
if (isDead_)
|
||||
|
|
@ -144,3 +148,10 @@ namespace lumiera {
|
|||
|
||||
} // namespace lumiera
|
||||
#endif
|
||||
/*
|
||||
// Local Variables:
|
||||
// mode: C++
|
||||
// c-file-style: "gnu"
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace lib {
|
|||
}
|
||||
|
||||
public:
|
||||
ClassLock() : Lock (getPerClassMonitor()) {}
|
||||
ClassLock(...) : Lock (getPerClassMonitor()) {}
|
||||
|
||||
uint use_count() { return nifty::Holder<PerClassMonitor>::accessed_; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
#ifndef LIB_SYNC_H
|
||||
#define LIB_SYNC_H
|
||||
|
||||
#include "include/nobugcfg.h"
|
||||
#include "common/logging.h"
|
||||
#include "lib/error.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "pre.hpp"
|
||||
|
||||
|
||||
#include "include/nobugcfg.h"
|
||||
#include "common/logging.h"
|
||||
|
||||
#include "lib/test/suite.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include <sstream>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "include/nobugcfg.h"
|
||||
#include "common/logging.h"
|
||||
#include "lib/cmdline.hpp"
|
||||
#include "lib/test/suite.hpp"
|
||||
#include "lib/test/run.hpp"
|
||||
|
|
|
|||
Loading…
Reference in a new issue