1 Star 1 Fork 0

Rong Tao/autofdo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
profile_creator.h 2.08 KB
一键复制 编辑 原始数据 按行查看 历史
Wei Mi 提交于 2021-09-15 22:55 . Update to the latest internal version.
// Copyright 2011 Google Inc. All Rights Reserved.
// Author: dehao@google.com (Dehao Chen)
// Create AutoFDO profile.
#ifndef AUTOFDO_PROFILE_CREATOR_H_
#define AUTOFDO_PROFILE_CREATOR_H_
#include <cstdint>
#include "addr2line.h"
#include "profile_writer.h"
#include "sample_reader.h"
#include "symbol_map.h"
namespace devtools_crosstool_autofdo {
class ProfileCreator {
public:
explicit ProfileCreator(const std::string &binary)
: sample_reader_(nullptr), binary_(binary) {}
~ProfileCreator() {
delete sample_reader_;
}
// Returns the total sample counts from a text profile.
static uint64_t GetTotalCountFromTextProfile(
const std::string &input_profile_name);
// Creates AutoFDO profile, returns true if success, false otherwise.
bool CreateProfile(const std::string &input_profile_name,
const std::string &profiler,
devtools_crosstool_autofdo::ProfileWriter *writer,
const std::string &output_profile_name,
bool store_sym_list_in_profile = false);
// Reads samples from the input profile.
bool ReadSample(const std::string &input_profile_name,
const std::string &profiler);
// Returns total number of samples collected.
uint64_t TotalSamples();
// Returns the SampleReader pointer.
const devtools_crosstool_autofdo::SampleReader &sample_reader() {
return *sample_reader_;
}
// Computes the profile and updates the given symbol map and addr2line
// instance.
bool ComputeProfile(devtools_crosstool_autofdo::SymbolMap *symbol_map);
private:
bool ConvertPrefetchHints(const std::string &profile_file,
SymbolMap *symbol_map);
bool CheckAndAssignAddr2Line(SymbolMap *symbol_map, Addr2line *addr2line);
SampleReader *sample_reader_;
std::string binary_;
};
bool MergeSample(const std::string &input_file,
const std::string &input_profiler, const std::string &binary,
const std::string &output_file);
} // namespace devtools_crosstool_autofdo
#endif // AUTOFDO_PROFILE_CREATOR_H_
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rtoax/autofdo.git
git@gitee.com:rtoax/autofdo.git
rtoax
autofdo
autofdo
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385