Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Unified Diff: src/IceELFObjectWriter.cpp

Issue 1775603002: Fix timing of parseFunctions. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/IceGlobalContext.cpp » ('j') | src/IceTimerTree.def » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceELFObjectWriter.cpp
diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp
index 762745799bb1240696204f527c5f5fa7025a6da6..5f3b0d3e2adb55e61da7c0dc0d087ccaa03a645a 100644
--- a/src/IceELFObjectWriter.cpp
+++ b/src/IceELFObjectWriter.cpp
@@ -219,6 +219,14 @@ Elf64_Off ELFObjectWriter::alignFileOffset(Elf64_Xword Align) {
void ELFObjectWriter::writeFunctionCode(const IceString &FuncName,
bool IsInternal, Assembler *Asm) {
assert(!SectionNumbersAssigned);
+ TimerMarker Timer(TimerStack::TT_writeELF, &Ctx);
+ constexpr Ice::TimerStackIdT StackID = Ice::GlobalContext::TSK_Funcs;
John 2016/03/07 22:40:39 No need to fully qualify these.
Karl 2016/03/08 21:52:47 Done.
+ Ice::TimerIdT TimerID = 0;
+ bool TimeThisFunction = Ctx.getFlags().getTimeEachFunction();
+ if (TimeThisFunction) {
+ TimerID = Ctx.getTimerID(StackID, FuncName);
+ Ctx.pushTimer(TimerID, StackID);
+ }
ELFTextSection *Section = nullptr;
ELFRelocationSection *RelSection = nullptr;
const bool FunctionSections = Ctx.getFlags().getFunctionSections();
@@ -270,6 +278,8 @@ void ELFObjectWriter::writeFunctionCode(const IceString &FuncName,
RelSection->addRelocations(OffsetInSection, Asm->fixups());
}
Section->appendData(Str, Asm->getBufferView());
+ if (TimeThisFunction)
+ Ctx.popTimer(TimerID, StackID);
}
namespace {
@@ -303,6 +313,7 @@ void ELFObjectWriter::writeDataSection(const VariableDeclarationList &Vars,
FixupKind RelocationKind,
const IceString &SectionSuffix,
bool IsPIC) {
+ TimerMarker Timer(TimerStack::TT_writeELF, &Ctx);
assert(!SectionNumbersAssigned);
VariableDeclarationList VarsBySection[ELFObjectWriter::NumSectionTypes];
for (auto &SectionList : VarsBySection)
@@ -442,6 +453,7 @@ void ELFObjectWriter::writeDataOfType(SectionType ST,
}
void ELFObjectWriter::writeInitialELFHeader() {
+ TimerMarker Timer(TimerStack::TT_writeELF, &Ctx);
assert(!SectionNumbersAssigned);
constexpr Elf64_Off DummySHOffset = 0;
constexpr SizeT DummySHStrIndex = 0;
@@ -503,6 +515,7 @@ void ELFObjectWriter::writeELFHeaderInternal(Elf64_Off SectionHeaderOffset,
}
template <typename ConstType> void ELFObjectWriter::writeConstantPool(Type Ty) {
+ TimerMarker Timer(TimerStack::TT_writeELF, &Ctx);
ConstantList Pool = Ctx.getConstantPool(Ty);
if (Pool.empty()) {
return;
@@ -579,6 +592,7 @@ void ELFObjectWriter::writeAllRelocationSections() {
void ELFObjectWriter::writeJumpTable(const JumpTableData &JT,
FixupKind RelocationKind, bool IsPIC) {
+ TimerMarker Timer(TimerStack::TT_writeELF, &Ctx);
ELFDataSection *Section;
ELFRelocationSection *RelSection;
const Elf64_Xword PointerSize = typeWidthInBytes(getPointerType());
@@ -648,6 +662,8 @@ void ELFObjectWriter::writeRelocationSections(RelSectionList &RelSections) {
}
void ELFObjectWriter::writeNonUserSections() {
+ TimerMarker Timer(TimerStack::TT_writeELF, &Ctx);
+
// Write out the shstrtab now that all sections are known.
ShStrTab->doLayout();
ShStrTab->setSize(ShStrTab->getSectionDataSize());
« no previous file with comments | « no previous file | src/IceGlobalContext.cpp » ('j') | src/IceTimerTree.def » ('J')

Powered by Google App Engine
This is Rietveld 408576698