Previous 199869 Revisions Next

r21152 Sunday 17th February, 2013 at 20:47:48 UTC by Nathan Woods
Added a new 'lastinstructioncycles' property to the debugger to measure the
amount of CPU cycles taken by the last instruction.  This is useful to people
(me) who are rewriting CPU cores, specifically with regression testing.
[src/emu/debug]debugcpu.c debugcpu.h

trunk/src/emu/debug/debugcpu.c
r21151r21152
16491649      m_stopirq(0),
16501650      m_stopexception(0),
16511651      m_endexectime(attotime::zero),
1652      m_total_cycles(0),
1653      m_last_total_cycles(0),
16521654      m_pc_history_index(0),
16531655      m_bplist(NULL),
16541656      m_trace(NULL),
r21151r21152
16751677      {
16761678         m_symtable.add("cycles", NULL, get_cycles);
16771679         m_symtable.add("totalcycles", NULL, get_totalcycles);
1680         m_symtable.add("lastinstructioncycles", NULL, get_lastinstructioncycles);
16781681      }
16791682
16801683      // add entries to enable/disable unmap reporting for each space
r21151r21152
18571860   // update the history
18581861   m_pc_history[m_pc_history_index++ % HISTORY_SIZE] = curpc;
18591862
1863   // update total cycles
1864   m_last_total_cycles = m_total_cycles;
1865   m_total_cycles = m_exec->total_cycles();
1866
18601867   // are we tracing?
18611868   if (m_trace != NULL)
18621869      m_trace->update(curpc);
r21151r21152
30753082UINT64 device_debug::get_totalcycles(symbol_table &table, void *ref)
30763083{
30773084   device_t *device = reinterpret_cast<device_t *>(table.globalref());
3078   return device->debug()->m_exec->total_cycles();
3085   return device->debug()->m_total_cycles;
30793086}
30803087
30813088
30823089//-------------------------------------------------
3090//  get_lastinstructioncycles - getter callback for the
3091//  'lastinstructioncycles' symbol
3092//-------------------------------------------------
3093
3094UINT64 device_debug::get_lastinstructioncycles(symbol_table &table, void *ref)
3095{
3096   device_t *device = reinterpret_cast<device_t *>(table.globalref());
3097   device_debug *debug = device->debug();
3098   return debug->m_total_cycles - debug->m_last_total_cycles;
3099}
3100
3101
3102//-------------------------------------------------
30833103//  get_logunmap - getter callback for the logumap
30843104//  symbols
30853105//-------------------------------------------------
trunk/src/emu/debug/debugcpu.h
r21151r21152
244244   static UINT64 get_current_pc(symbol_table &table, void *ref);
245245   static UINT64 get_cycles(symbol_table &table, void *ref);
246246   static UINT64 get_totalcycles(symbol_table &table, void *ref);
247   static UINT64 get_lastinstructioncycles(symbol_table &table, void *ref);
247248   static UINT64 get_logunmap(symbol_table &table, void *ref);
248249   static void set_logunmap(symbol_table &table, void *ref, UINT64 value);
249250   static UINT64 get_state(symbol_table &table, void *ref);
r21151r21152
275276   int                     m_stopirq;                  // stop IRQ number for DEBUG_FLAG_STOP_INTERRUPT
276277   int                     m_stopexception;            // stop exception number for DEBUG_FLAG_STOP_EXCEPTION
277278   attotime                m_endexectime;              // ending time of the current execution
279   UINT64               m_total_cycles;            // current total cycles
280   UINT64               m_last_total_cycles;      // last total cycles
278281
279282   // history
280283   offs_t                  m_pc_history[HISTORY_SIZE]; // history of recent PCs

Previous 199869 Revisions Next


© 1997-2024 The MAME Team