#include "ui/latency/latency_info.h"
#include <stddef.h>
#include <algorithm>
#include <string>
#include <utility>
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/trace_event/trace_event.h"
#include "services/tracing/public/cpp/perfetto/flow_event_utils.h"
#include "services/tracing/public/cpp/perfetto/macros.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/chrome_latency_info.pbzero.h"
namespace {
ChromeLatencyInfo;
TrackEvent;
const size_t kMaxLatencyInfoNumber = …;
ChromeLatencyInfo::LatencyComponentType GetComponentProtoEnum(
ui::LatencyComponentType type) { … }
bool IsInputLatencyBeginComponent(ui::LatencyComponentType type) { … }
constexpr const char kTraceCategoriesForAsyncEvents[] = …;
struct LatencyInfoEnabledInitializer { … };
static base::LazyInstance<LatencyInfoEnabledInitializer>::Leaky
g_latency_info_enabled = …;
}
namespace ui {
LatencyInfo::LatencyInfo() = default;
LatencyInfo::LatencyInfo(const LatencyInfo& other) = default;
LatencyInfo::LatencyInfo(LatencyInfo&& other) = default;
LatencyInfo::~LatencyInfo() = default;
LatencyInfo::LatencyInfo(int64_t trace_id, bool terminated)
: … { … }
LatencyInfo& LatencyInfo::operator=(const LatencyInfo& other) = default;
bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info,
const char* referring_msg) { … }
void LatencyInfo::TraceIntermediateFlowEvents(
const std::vector<LatencyInfo>& latency_info,
perfetto::protos::pbzero::ChromeLatencyInfo::Step step) { … }
void LatencyInfo::AddNewLatencyFrom(const LatencyInfo& other) { … }
void LatencyInfo::AddLatencyNumber(LatencyComponentType component) { … }
void LatencyInfo::AddLatencyNumberWithTraceName(LatencyComponentType component,
const char* trace_name_str,
base::TimeTicks now) { … }
void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component,
base::TimeTicks time) { … }
void LatencyInfo::AddLatencyNumberWithTimestampImpl(
LatencyComponentType component,
base::TimeTicks time,
const char* trace_name_str) { … }
void LatencyInfo::Terminate() { … }
bool LatencyInfo::FindLatency(LatencyComponentType type,
base::TimeTicks* output) const { … }
}