Previous 199869 Revisions Next

r31240 Wednesday 9th July, 2014 at 15:52:27 UTC by Alex Jackson
schedule.c: minor logging improvements (nw)
[src/emu]schedule.c

trunk/src/emu/schedule.c
r31239r31240
1919#define VERBOSE 0
2020
2121#define LOG(x)  do { if (VERBOSE) logerror x; } while (0)
22#define PRECISION
2223
2324
2425
r31239r31240
292293
293294void emu_timer::dump() const
294295{
295   logerror("%p: en=%d temp=%d exp=%15s start=%15s per=%15s param=%d ptr=%p", this, m_enabled, m_temporary, m_expire.as_string(), m_start.as_string(), m_period.as_string(), m_param, m_ptr);
296   logerror("%p: en=%d temp=%d exp=%15s start=%15s per=%15s param=%d ptr=%p", this, m_enabled, m_temporary, m_expire.as_string(PRECISION), m_start.as_string(PRECISION), m_period.as_string(PRECISION), m_param, m_ptr);
296297   if (m_device == NULL)
297298      logerror(" cb=%s\n", m_callback.name());
298299   else
r31239r31240
433434         target = m_timer_list->m_expire;
434435
435436      LOG(("------------------\n"));
436      LOG(("cpu_timeslice: target = %s\n", target.as_string()));
437      LOG(("cpu_timeslice: target = %s\n", target.as_string(PRECISION)));
437438
438439      // do we have pending suspension changes?
439440      if (m_suspend_changes_pending)
r31239r31240
459460            {
460461               // compute how many cycles we want to execute
461462               int ran = exec->m_cycles_running = divu_64x32((UINT64)delta >> exec->m_divshift, exec->m_divisor);
462               LOG(("  cpu '%s': %d cycles\n", exec->device().tag(), exec->m_cycles_running));
463               LOG(("  cpu '%s': %"I64FMT"d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running));
463464
464465               // if we're not suspended, actually execute
465466               if (exec->m_suspend == 0)
r31239r31240
495496               attotime delta = attotime(0, exec->m_attoseconds_per_cycle * ran);
496497               assert(delta >= attotime::zero);
497498               exec->m_localtime += delta;
498               LOG(("         %d ran, %d total, time = %s\n", ran, (INT32)exec->m_totalcycles, exec->m_localtime.as_string()));
499               LOG(("         %d ran, %d total, time = %s\n", ran, (INT32)exec->m_totalcycles, exec->m_localtime.as_string(PRECISION)));
499500
500501               // if the new local CPU time is less than our target, move the target up, but not before the base
501502               if (exec->m_localtime < target)
r31239r31240
874875
875876inline void device_scheduler::execute_timers()
876877{
877   LOG(("execute_timers: new=%s head->expire=%s\n", m_basetime.as_string(), m_timer_list->m_expire.as_string()));
878   LOG(("execute_timers: new=%s head->expire=%s\n", m_basetime.as_string(PRECISION), m_timer_list->m_expire.as_string(PRECISION)));
878879
879880   // now process any timers that are overdue
880881   while (m_timer_list->m_expire <= m_basetime)
r31239r31240
897898
898899         if (timer.m_device != NULL)
899900         {
900            LOG(("execute_timers: timer device %s timer %d\n", timer.m_device->name(), timer.m_id));
901            LOG(("execute_timers: timer device %s timer %d\n", timer.m_device->tag(), timer.m_id));
901902            timer.m_device->timer_expired(timer, timer.m_id, timer.m_param, timer.m_ptr);
902903         }
903904         else if (!timer.m_callback.isnull())
r31239r31240
978979void device_scheduler::dump_timers() const
979980{
980981   logerror("=============================================\n");
981   logerror("Timer Dump: Time = %15s\n", time().as_string());
982   logerror("Timer Dump: Time = %15s\n", time().as_string(PRECISION));
982983   for (emu_timer *timer = first_timer(); timer != NULL; timer = timer->next())
983984      timer->dump();
984985   logerror("=============================================\n");

Previous 199869 Revisions Next


© 1997-2024 The MAME Team