📄 metrics_logger.cpp
字号:
if (generate_totals_)
{
#if defined (ACE_LACKS_LONGLONG_T)
// This needs to be fixed for platforms that do not have 64 bit support. This will result
// in overruns as currently written
ACE_OS::fprintf (log_file_,
" %-40s (total) %20lu %20lu %20lu *** Cross Thread Event ***\n",
(const char *) *probe_name,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].interval)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].start_event_time)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].stop_event_time)/10);
ACE_OS::fprintf (export_file_,
" %s (total) \t %lu \t %lu \t %lu \t ***Cross Thread Event***\n",
(const char *) *probe_name,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].interval)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].start_event_time)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].stop_event_time)/10);
#else
// Build up the format specifiers since the specifier or not portable
ACE_OS::strcpy(format_spec, " %-40s (total) ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " *** Cross Thread Event ***\n");
ACE_OS::strcpy(export_spec, " %-40s (total) \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t*** Cross Thread Event ***\n");
ACE_OS::fprintf (log_file_,
format_spec,
(const char *) *probe_name,
timeprobe_params [i].interval / 10,
timeprobe_params [i].start_event_time / 10,
timeprobe_params [i].stop_event_time / 10);
ACE_OS::fprintf (export_file_,
export_spec,
(const char *) *probe_name,
timeprobe_params [i].interval / 10,
timeprobe_params [i].start_event_time / 10,
timeprobe_params [i].stop_event_time / 10);
#endif
}
}
else
{
#if defined (ACE_LACKS_LONGLONG_T)
// This needs to be fixed for platforms that do not have 64 bit support. This will result
// in overruns as currently written
ACE_OS::fprintf (log_file_,
" %-40s %20lu %20lu %20lu *** Cross Thread Event ***\n",
(const char *) *probe_name,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].interval)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].start_event_time)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].stop_event_time)/10);
ACE_OS::fprintf (export_file_,
" %s \t %lu \t %lu \t %lu \t ***Cross Thread Event***\n",
(const char *) *probe_name,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].interval)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].start_event_time)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].stop_event_time)/10);
#else
// Build up the format specifiers since the specifier or not portable
ACE_OS::strcpy(format_spec, " %-40s ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " *** Cross Thread Event ***\n");
ACE_OS::strcpy(export_spec, " %-40s \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t *** Cross Thread Event ***\n");
ACE_OS::fprintf (log_file_,
format_spec,
(const char *) *probe_name,
timeprobe_params [i].interval / 10,
timeprobe_params [i].start_event_time / 10,
timeprobe_params [i].stop_event_time / 10);
ACE_OS::fprintf (export_file_,
export_spec,
(const char *) *probe_name,
timeprobe_params [i].interval / 10,
timeprobe_params [i].start_event_time / 10,
timeprobe_params [i].stop_event_time / 10);
#endif
}
}
else
{
if (timeprobe_params [i].cross_thread_probe &&
timeprobe_params [i].is_full_interval)
{
if (generate_totals_)
#if defined (ACE_LACKS_LONGLONG_T)
ACE_OS::fprintf (log_file_,
" [id (total): %8lu] %9lu %9lu %9lu *** Cross Thread Event ***\n",
timeprobe_params [i].probe_id,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].interval)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].start_event_time)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].stop_event_time)/10);
ACE_OS::fprintf (export_file_,
" [id (total): %lu] \t %lu \t %lu \t %lu \t ***Cross Thread Event***\n",
timeprobe_params [i].probe_id,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].interval)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].start_event_time)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].stop_event_time)/10);
#else
// Build up the format specifiers since the specifier or not portable
ACE_OS::strcpy(format_spec, " [id (total): %8lu] ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " *** Cross Thread Event ***\n");
ACE_OS::strcpy(export_spec, " [id (total): %8lu] \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t*** Cross Thread Event ***\n");
if (probe_name == 0)
{
ACE_DEBUG((LM_DEBUG, "Found a probe with id: %d with no name\n", timeprobe_params [i].probe_id));
}
else
{
ACE_OS::fprintf (log_file_,
format_spec,
(const char *) *probe_name,
timeprobe_params [i].interval / 10,
timeprobe_params [i].start_event_time / 10,
timeprobe_params [i].stop_event_time / 10);
ACE_OS::fprintf (export_file_,
export_spec,
(const char *) *probe_name,
timeprobe_params [i].interval / 10,
timeprobe_params [i].start_event_time / 10,
timeprobe_params [i].stop_event_time / 10);
}
#endif
}
else
#if defined (ACE_LACKS_LONGLONG_T)
ACE_OS::fprintf (log_file_,
" [id: %14lu] %9lu %9lu %9lu \n",
timeprobe_params [i].probe_id,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].interval)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].start_event_time)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].stop_event_time)/10);
ACE_OS::fprintf (export_file_,
" [id: %lu] \t %lu \t %lu \t %lu\n",
timeprobe_params [i].probe_id,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].interval)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].start_event_time)/10,
(u_long) ACE_U64_TO_U32(timeprobe_params [i].stop_event_time)/10);
#else
// Build up the format specifiers since the specifier or not portable
ACE_OS::strcpy(format_spec, " [id: %14lu] ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " ");
ACE_OS::strcat(format_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(format_spec, " *** Cross Thread Event ***\n");
ACE_OS::strcpy(export_spec, " [id: %lu] \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " \t ");
ACE_OS::strcat(export_spec, ACE_UINT64_FORMAT_SPECIFIER);
ACE_OS::strcat(export_spec, " *** Cross Thread Event ***\n");
if (probe_name == 0)
{
ACE_DEBUG((LM_DEBUG, "Found a probe with id: %d with no name\n", timeprobe_params [i].probe_id));
}
else
{
ACE_OS::fprintf (log_file_,
format_spec,
(const char *) *probe_name,
timeprobe_params [i].interval / 10,
timeprobe_params [i].start_event_time / 10,
timeprobe_params [i].stop_event_time / 10);
ACE_OS::fprintf (export_file_,
export_spec,
(const char *) *probe_name,
timeprobe_params [i].interval / 10,
timeprobe_params [i].start_event_time / 10,
timeprobe_params [i].stop_event_time / 10);
}
#endif
}
} // End if (this->generate_log_)
}
#if defined (METRICS_LOGGER_SENDS_EVENTS)
if (this->generate_events_)
{
CORBA::Any any;
util_data_.hrt_op_utilization =
ACE_static_cast (
CORBA::Double,
ACE_UINT64_DBLCAST_ADAPTER (hrt_op_time))
/ ACE_static_cast (
CORBA::Double,
ACE_UINT64_DBLCAST_ADAPTER (interval));
util_data_.srt_op_utilization =
ACE_static_cast (
CORBA::Double,
ACE_UINT64_DBLCAST_ADAPTER (srt_op_time))
/ ACE_static_cast (
CORBA::Double,
ACE_UINT64_DBLCAST_ADAPTER (interval));
util_data_.queue_utilization =
ACE_static_cast (
CORBA::Double,
ACE_UINT64_DBLCAST_ADAPTER (queue_time))
/ ACE_static_cast (
CORBA::Double,
ACE_UINT64_DBLCAST_ADAPTER (interval));
ACE_TRY_NEW_ENV
{
any.replace (Metrics::_tc_UtilData, &util_data_, 0, ACE_TRY_ENV);
ACE_TRY_CHECK;
}
ACE_CATCHANY
{
#if defined (METRICS_LOGGER_ERROR_OUTPUT_ENABLED)
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Metrics_Logger::process_aggregate_QoS");
#endif
return;
}
ACE_ENDTRY;
this->dove_supplier_.notify (any);
}
#endif /* METRICS_LOGGER_SENDS_EVENTS */
if (this->generate_log_)
{
if (log_filename_)
{
ACE_OS::fflush (log_file_);
ACE_OS::fflush (export_file_);
// ACE_OS::fclose (log_file_);
}
}
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
// Already instantiated in Transport_Mux_Strategy ... otherwise VxWorks gets dual
// definition link error
//template class ACE_Equal_To<CORBA::ULong>;
// The below template already instantiated in ../ace/Funchtor.h
// template class ACE_Hash<CORBA::ULong>;
template class ACE_Hash_Map_Manager_Ex<CORBA::ULong, CORBA::String_var *, ACE_Hash<CORBA::ULong>, ACE_Equal_To<CORBA::ULong>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Iterator_Base_Ex<CORBA::ULong, CORBA::String_var *, ACE_Hash<CORBA::ULong>, ACE_Equal_To<CORBA::ULong>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Iterator_Ex<CORBA::ULong, CORBA::String_var *, ACE_Hash<CORBA::ULong>, ACE_Equal_To<CORBA::ULong>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Reverse_Iterator_Ex<CORBA::ULong, CORBA::String_var *, ACE_Hash<CORBA::ULong>, ACE_Equal_To<CORBA::ULong>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Entry<CORBA::ULong, CORBA::String_var *>;
#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Equal_To<CORBA::ULong>
//#pragma instantiate ACE_Hash<CORBA::ULong>
#pragma instantiate ACE_Hash_Map_Manager_Ex<CORBA::ULong, CORBA::String_var *, ACE_Hash<CORBA::ULong>, ACE_Equal_To<CORBA::ULong>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<CORBA::ULong, CORBA::String_var *, ACE_Hash<CORBA::ULong>, ACE_Equal_To<CORBA::ULong>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Iterator_Ex<CORBA::ULong, CORBA::String_var *, ACE_Hash<CORBA::ULong>, ACE_Equal_To<CORBA::ULong>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<CORBA::ULong, CORBA::String_var *, ACE_Hash<CORBA::ULong>, ACE_Equal_To<CORBA::ULong>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Entry<CORBA::ULong, CORBA::String_var *>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
#endif /* ACE_ENABLE_TIMEPROBES & ACE_COMPILE_TIMEPROBES */
#endif /* ACE_METRICS_COLLECTION */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -