コード例 #1
0
ファイル: EventLogger.cpp プロジェクト: sfsy1989/j2me
void EventLogger::dump(Stream *s) {
  jlong freq = Os::elapsed_frequency();
  bool use_usec = (freq > 100 * 1000);

  if (use_usec) {
    s->print("      msec");
  } else {
    s->print("  msec");
  }
  s->print_cr("   hrtick event");
  s->print_cr("=======================================");

  jlong last_hrticks = 0;
  for (LogEntryBlock *blk = _head; blk; blk = blk->_next) {
    for (int i=0; i<blk->_used_count; i++) {
      LogEntry *entry = &blk->_entries[i];
      const char *name = "??";
      switch (entry->_type) {
        EVENT_LOGGER_TYPES_DO(CASE_OF_EVENT_LOGGER_TYPE);
      default:
        SHOULD_NOT_REACH_HERE();
        break;
      }
      jlong time = last_hrticks + entry->_hrtick_delta;
      jlong usec = time * 1000 * 1000 / freq;
      jlong msec = usec / 1000;
      usec = usec % 1000;
      last_hrticks = time;

      s->print("%6d", (jint)msec);
      if (use_usec) {
        s->print(".");
        if (usec < 100) {
          s->print("0");
        }
        if (usec < 10) {
          s->print("0");
        }
        s->print("%d", usec);
      }
      s->print_cr(" %8d %s", (jint)time, name);
    }
    s->print_cr("=======================================");
  }
}
コード例 #2
0
 */

# include "incls/_precompiled.incl"
# include "incls/_EventLogger.cpp.incl"

#if USE_EVENT_LOGGER

const char* 
#if ENABLE_EXTENDED_EVENT_LOGGER
  EventLogger::_event_names[EventLogger::Entry::max_event_types+1] =
#else
  const EventLogger::_event_names[] =
#endif
{
# define NAME_EVENT_LOGGER_TYPE(x) #x,
  EVENT_LOGGER_TYPES_DO(NAME_EVENT_LOGGER_TYPE)
# undef NAME_EVENT_LOGGER_TYPE
};

#if ENABLE_EXTENDED_EVENT_LOGGER
inline bool EventLogger::validate_event_type( const char c ) {
  return ('A' <= c && c <= 'Z') ||
         ('a' <= c && c <= 'b') ||
         ('0' <= c && c <= '9') || c == '_';
}

inline bool EventLogger::validate_event_type( const char name[] ) {
  if( *name ) {
    const char* p = name;
    for( ; validate_event_type( *p ); p++ ) {
      if( (p - name) > JVM_MAX_EVENT_NAME_LENGTH ) {