#include "src/trace_processor/importers/common/process_tracker.h"
#include <algorithm>
#include <cstdint>
#include <optional>
#include <utility>
#include <vector>
#include "perfetto/base/logging.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/public/compiler.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/tables/metadata_tables_py.h"
#include "src/trace_processor/types/trace_processor_context.h"
namespace perfetto::trace_processor {
ProcessTracker::ProcessTracker(TraceProcessorContext* context)
: … { … }
ProcessTracker::~ProcessTracker() = default;
UniqueTid ProcessTracker::StartNewThread(std::optional<int64_t> timestamp,
uint32_t tid) { … }
void ProcessTracker::EndThread(int64_t timestamp, uint32_t tid) { … }
std::optional<UniqueTid> ProcessTracker::GetThreadOrNull(uint32_t tid) { … }
UniqueTid ProcessTracker::GetOrCreateThread(uint32_t tid) { … }
UniqueTid ProcessTracker::UpdateThreadName(uint32_t tid,
StringId thread_name_id,
ThreadNamePriority priority) { … }
void ProcessTracker::UpdateThreadNameByUtid(UniqueTid utid,
StringId thread_name_id,
ThreadNamePriority priority) { … }
bool ProcessTracker::IsThreadAlive(UniqueTid utid) { … }
std::optional<UniqueTid> ProcessTracker::GetThreadOrNull(
uint32_t tid,
std::optional<uint32_t> pid) { … }
UniqueTid ProcessTracker::UpdateThread(uint32_t tid, uint32_t pid) { … }
void ProcessTracker::UpdateTrustedPid(uint32_t trusted_pid, uint64_t uuid) { … }
std::optional<uint32_t> ProcessTracker::GetTrustedPid(uint64_t uuid) { … }
std::optional<uint32_t> ProcessTracker::ResolveNamespacedTid(
uint32_t root_level_pid,
uint32_t tid) { … }
UniquePid ProcessTracker::StartNewProcess(std::optional<int64_t> timestamp,
std::optional<uint32_t> parent_tid,
uint32_t pid,
StringId main_thread_name,
ThreadNamePriority priority) { … }
UniquePid ProcessTracker::SetProcessMetadata(uint32_t pid,
std::optional<uint32_t> ppid,
base::StringView name,
base::StringView cmdline) { … }
void ProcessTracker::SetProcessUid(UniquePid upid, uint32_t uid) { … }
void ProcessTracker::SetProcessNameIfUnset(UniquePid upid,
StringId process_name_id) { … }
void ProcessTracker::SetStartTsIfUnset(UniquePid upid,
int64_t start_ts_nanoseconds) { … }
void ProcessTracker::UpdateThreadNameAndMaybeProcessName(
uint32_t tid,
StringId thread_name,
ThreadNamePriority priority) { … }
UniquePid ProcessTracker::GetOrCreateProcess(uint32_t pid) { … }
void ProcessTracker::AssociateThreads(UniqueTid utid1, UniqueTid utid2) { … }
void ProcessTracker::ResolvePendingAssociations(UniqueTid utid_arg,
UniquePid upid) { … }
void ProcessTracker::AssociateThreadToProcess(UniqueTid utid, UniquePid upid) { … }
void ProcessTracker::SetPidZeroIsUpidZeroIdleProcess() { … }
ArgsTracker::BoundInserter ProcessTracker::AddArgsTo(UniquePid upid) { … }
void ProcessTracker::NotifyEndOfFile() { … }
void ProcessTracker::UpdateNamespacedProcess(uint32_t pid,
std::vector<uint32_t> nspid) { … }
void ProcessTracker::UpdateNamespacedThread(uint32_t pid,
uint32_t tid,
std::vector<uint32_t> nstid) { … }
}