debug code cleanup

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7479 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2004-05-09 20:50:20 +00:00
parent 9b4b9246a3
commit 6000570ec3
3 changed files with 6 additions and 17 deletions
@@ -30,6 +30,7 @@
#define DEBUG_INIT 1 #define DEBUG_INIT 1
#define DEBUG_IOCTL 1 #define DEBUG_IOCTL 1
#define DEBUG_HW 1 #define DEBUG_HW 1
#define DEBUG_TRACE_STATS 1
#define DBG_STATS 1 #define DBG_STATS 1
#else #else
@@ -41,6 +42,7 @@
#define DEBUG_INIT 0 #define DEBUG_INIT 0
#define DEBUG_IOCTL 0 #define DEBUG_IOCTL 0
#define DEBUG_HW 0 #define DEBUG_HW 0
#define DEBUG_TRACE_STATS 0
#undef DBG_STATS #undef DBG_STATS
#endif #endif
@@ -40,7 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
/********************************************************************* /*********************************************************************
* Set this to one to display debug statistics * Set this to one to display debug statistics
*********************************************************************/ *********************************************************************/
int em_display_debug_stats = 1; int em_display_debug_stats = DEBUG_TRACE_STATS;
/********************************************************************* /*********************************************************************
* Function prototypes * Function prototypes
@@ -20,13 +20,12 @@
#include <OS.h> #include <OS.h>
#include <string.h> #include <string.h>
#define DEBUG 1
#include "debug.h" #include "debug.h"
#include "timer.h" #include "timer.h"
#define MAX_TIMERS 32 #define MAX_TIMERS 32
struct timer_info struct timer_info
{ {
timer_id id; timer_id id;
@@ -37,6 +36,7 @@ struct timer_info
bool periodic; bool periodic;
}; };
static struct timer_info sTimerData[MAX_TIMERS]; static struct timer_info sTimerData[MAX_TIMERS];
static int sTimerCount; static int sTimerCount;
static timer_id sTimerNextId; static timer_id sTimerNextId;
@@ -44,13 +44,12 @@ static thread_id sTimerThread;
static sem_id sTimerSem; static sem_id sTimerSem;
static spinlock sTimerSpinlock; static spinlock sTimerSpinlock;
static int32 static int32
timer_thread(void *cookie) timer_thread(void *cookie)
{ {
status_t status = 0; status_t status = 0;
TRACE("timer_thread enter\n");
do { do {
bigtime_t timeout; bigtime_t timeout;
bigtime_t now; bigtime_t now;
@@ -77,8 +76,6 @@ timer_thread(void *cookie)
} }
} }
TRACE("timer index %d\n", index);
if (timeout < now) { if (timeout < now) {
// timer is ready for execution, load func and cookie // timer is ready for execution, load func and cookie
ASSERT(index >= 0 && index < sTimerCount); ASSERT(index >= 0 && index < sTimerCount);
@@ -109,8 +106,6 @@ timer_thread(void *cookie)
status = acquire_sem_etc(sTimerSem, 1, B_ABSOLUTE_TIMEOUT, timeout); status = acquire_sem_etc(sTimerSem, 1, B_ABSOLUTE_TIMEOUT, timeout);
} while (status == B_OK || status == B_TIMED_OUT); } while (status == B_OK || status == B_TIMED_OUT);
TRACE("timer_thread leave\n");
return 0; return 0;
} }
@@ -121,8 +116,6 @@ create_timer(timer_function func, void *cookie, bigtime_t interval, uint32 flags
cpu_status cpu; cpu_status cpu;
timer_id id; timer_id id;
TRACE("create_timer enter\n");
if (func == 0) if (func == 0)
return -1; return -1;
@@ -151,8 +144,6 @@ create_timer(timer_function func, void *cookie, bigtime_t interval, uint32 flags
if (id != -1) if (id != -1)
release_sem_etc(sTimerSem, 1, B_DO_NOT_RESCHEDULE); release_sem_etc(sTimerSem, 1, B_DO_NOT_RESCHEDULE);
TRACE("create_timer leave\n");
return id; return id;
} }
@@ -164,8 +155,6 @@ delete_timer(timer_id id)
bool deleted; bool deleted;
int i; int i;
TRACE("delete_timer enter\n");
deleted = false; deleted = false;
cpu = disable_interrupts(); cpu = disable_interrupts();
@@ -185,8 +174,6 @@ delete_timer(timer_id id)
release_spinlock(&sTimerSpinlock); release_spinlock(&sTimerSpinlock);
restore_interrupts(cpu); restore_interrupts(cpu);
TRACE("delete_timer leave\n");
if (!deleted) if (!deleted)
return B_ERROR; return B_ERROR;