Home / Class/ Trace Class — pytorch Architecture

Trace Class — pytorch Architecture

Architecture documentation for the Trace class in pytorch_jni_common.h from the pytorch codebase.

Entity Profile

Relationship Graph

Source Code

android/pytorch_android/src/main/cpp/pytorch_jni_common.h lines 30–72

class Trace {
 public:
#if defined(TRACE_ENABLED) && defined(__ANDROID__)
  typedef void* (*fp_ATrace_beginSection)(const char* sectionName);
  typedef void* (*fp_ATrace_endSection)(void);

  static fp_ATrace_beginSection ATrace_beginSection;
  static fp_ATrace_endSection ATrace_endSection;
#endif

  static void ensureInit() {
    if (!Trace::is_initialized_) {
      init();
      Trace::is_initialized_ = true;
    }
  }

  static void beginSection(const char* name) {
    Trace::ensureInit();
#if defined(TRACE_ENABLED) && defined(__ANDROID__)
    ATrace_beginSection(name);
#endif
  }

  static void endSection() {
#if defined(TRACE_ENABLED) && defined(__ANDROID__)
    ATrace_endSection();
#endif
  }

  Trace(const char* name) {
    ensureInit();
    beginSection(name);
  }

  ~Trace() {
    endSection();
  }

 private:
  static void init();
  static bool is_initialized_;
};

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free