std::string PROCEDURE_TIMER::to_string(void) const { std::string res; res = idstr_rep + ":\n"; res += "Number of events: " + kvu_numtostr(event_count()) + "\n"; res += "Events over bound: " + kvu_numtostr(events_over_upper_bound()); res += " (" + kvu_numtostr(to_seconds(&upper_bound_rep), 8) + "sec)\n"; res += "Events under bound: " + kvu_numtostr(events_under_lower_bound()); res += " (" + kvu_numtostr(to_seconds(&lower_bound_rep), 8) + "sec)\n"; res += "Min duration in seconds: " + kvu_numtostr(min_duration_seconds(), 16) + "\n"; res += "Max duration in seconds: " + kvu_numtostr(max_duration_seconds(), 16) + "\n"; res += "Average duration in seconds: " + kvu_numtostr(average_duration_seconds(), 16) + "\n"; res += "Duration of last event: " + kvu_numtostr(last_duration_rep, 16) + "\n"; return(res); }
int idle() { static struct timeval pta = { 0, 0 }; static int process_time_count = 0; struct timeval now; if (pta.tv_sec == 0) gettimeofday(&pta, (struct timezone *) 0); int passed_pulses; if (!(passed_pulses = thecore_idle())) return 0; assert(passed_pulses > 0); DWORD t; while (passed_pulses--) { heartbeat(thecore_heart, ++thecore_heart->pulse); // To reduce the possibility of abort() in checkpointing thecore_tick(); } t = get_dword_time(); CHARACTER_MANAGER::instance().Update(thecore_heart->pulse); db_clientdesc->Update(t); s_dwProfiler[PROF_CHR_UPDATE] += (get_dword_time() - t); t = get_dword_time(); if (!io_loop(main_fdw)) return 0; s_dwProfiler[PROF_IO] += (get_dword_time() - t); log_rotate(); gettimeofday(&now, (struct timezone *) 0); ++process_time_count; if (now.tv_sec - pta.tv_sec > 0) { pt_log("[%3d] event %5d/%-5d idle %-4ld event %-4ld heartbeat %-4ld I/O %-4ld chrUpate %-4ld | WRITE: %-7d | PULSE: %d", process_time_count, num_events_called, event_count(), thecore_profiler[PF_IDLE], s_dwProfiler[PROF_EVENT], s_dwProfiler[PROF_HEARTBEAT], s_dwProfiler[PROF_IO], s_dwProfiler[PROF_CHR_UPDATE], current_bytes_written, thecore_pulse()); num_events_called = 0; current_bytes_written = 0; process_time_count = 0; gettimeofday(&pta, (struct timezone *) 0); memset(&thecore_profiler[0], 0, sizeof(thecore_profiler)); memset(&s_dwProfiler[0], 0, sizeof(s_dwProfiler)); } #ifdef _WIN32 if (_kbhit()) { int c = _getch(); switch (c) { case 0x1b: // Esc return 0; // shutdown break; default: break; } } #endif return 1; }
double PROCEDURE_TIMER::average_duration_seconds(void) const { return(event_time_total_rep / event_count()); }
jboolean VMEventModifier::match(DebuggerEvent *d_event, bool *should_delete) { *should_delete = false; if (d_event == NULL) return false; switch (mod_kind()) { case JDWP_EventRequest_Set_Out_modifiers_Modifier_Conditional: /* reserved for future use */ break; case JDWP_EventRequest_Set_Out_modifiers_Modifier_ThreadOnly: return thread_match(d_event); case JDWP_EventRequest_Set_Out_modifiers_Modifier_ClassOnly: return ((ClassMatchModifier *)this)->class_only(d_event); case JDWP_EventRequest_Set_Out_modifiers_Modifier_ClassMatch: return ((ClassMatchModifier *)this)->class_match(d_event); case JDWP_EventRequest_Set_Out_modifiers_Modifier_ClassExclude: return !((ClassMatchModifier *)this)->class_match(d_event); case JDWP_EventRequest_Set_Out_modifiers_Modifier_LocationOnly: return ((LocationModifier *)this)->match(d_event); case JDWP_EventRequest_Set_Out_modifiers_Modifier_ExceptionOnly: { ExceptionModifier *exm = (ExceptionModifier *)(this); bool ret = true; if (exm->clazz_id() != 0) { InstanceClass::Raw clazz1 = JavaDebugger::get_object_by_id(d_event->clazz_id()); InstanceClass::Raw clazz2 = JavaDebugger::get_object_by_id(exm->clazz_id()); if (!clazz1().is_subclass_of(&clazz2)) { ret = false; } } ret = ret && ((exm->sig_caught() && d_event->sig_caught()) || (exm->sig_uncaught() && d_event->sig_uncaught())); if (!ret) return false; break; } case JDWP_EventRequest_Set_Out_modifiers_Modifier_FieldOnly: break; case JDWP_EventRequest_Set_Out_modifiers_Modifier_Step: return ((StepModifier *)this)->match(d_event); case JDWP_EventRequest_Set_Out_modifiers_Modifier_Count: { int count; // just the fact that we have a count modifier means it is active if ((count = event_count()) == 1) { // we will send this event now set_count(0); // but first turn it off return true; } else if (count > 1) { // decrement and return false set_count(--count); return false; } else { // must be <=0, so no event *should_delete = true; return false; } } } return true; }