[PATCH] D26130: [ELF] - Implemented --symbol-ordering-file option.

Rafael Espíndola via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 06:44:44 PDT 2016


OK, I think I am able to test this and show it can improve page faults.

The script I used is attached. To get these crazy sampling rates I did

echo 100 > /proc/sys/kernel/perf_cpu_time_max_percent
echo 200000 >  /proc/sys/kernel/perf_event_max_sample_rate

I also patched llvm so the symbolizer would print all symbols,
including data and ifunc (also attached).

With that "clang --help" goes from 293 page faults to 196 page faults.

The time difference is from 0.002217410 to 0.001884017 seconds. Those
are small but reproducible numbers since perf report a variance of
0.29%.

I will check what I can get with firefox.

Cheers,
Rafael

On 1 November 2016 at 08:42, Rafael Ávila de Espíndola via
llvm-commits <llvm-commits at lists.llvm.org> wrote:
> rafael added a comment.
>
> Just some quick observations while building the patch :-)
>
>
>
> ================
> Comment at: ELF/SymbolListFile.cpp:65
> +namespace {
> +class SymbolOrderingListParser final : public ScriptParserBase {
> +public:
> ----------------
> It is not entirely clear you want the ScriptParser infrastructure. For example, do we have to handle quotes?
>
> I would probably make this format dead simple. One symbol per line, symbols with newlines are not supported.
>
>
>
> ================
> Comment at: ELF/Writer.cpp:679
> +  // Build sections order map from symbols list.
> +  DenseMap<InputSectionBase<ELFT> *, unsigned> SectionsOrder;
> +  for (size_t I = 0; I < Config->SymbolOrderingFile.size(); ++I) {
> ----------------
> This is crazy inefficient.
>
> You probably want to make SymbolOrderingFile a DenseMap from CachedStringRef to unsigned.
>
>
> ================
> Comment at: test/ELF/symbol-ordering-file.s:9
> +# BEFORE:      Contents of section .text:
> +# BEFORE-NEXT:  11000 11223344 55
> +
> ----------------
> Changing .text to .foo should make this easier to read as .foo doesn't have an implicit alignment.
>
>
> https://reviews.llvm.org/D26130
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
diff --git a/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
index f694008..84377ad 100644
--- a/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ b/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
@@ -124,8 +124,8 @@ std::error_code SymbolizableObjectFile::addSymbol(const SymbolRef &Symbol,
   if (!SymbolTypeOrErr)
     return errorToErrorCode(SymbolTypeOrErr.takeError());
   SymbolRef::Type SymbolType = *SymbolTypeOrErr;
-  if (SymbolType != SymbolRef::ST_Function && SymbolType != SymbolRef::ST_Data)
-    return std::error_code();
+  //  if (SymbolType != SymbolRef::ST_Function && SymbolType != SymbolRef::ST_Data)
+  //    return std::error_code();
   Expected<uint64_t> SymbolAddressOrErr = Symbol.getAddress();
   if (!SymbolAddressOrErr)
     return errorToErrorCode(SymbolAddressOrErr.takeError());
@@ -151,7 +151,7 @@ std::error_code SymbolizableObjectFile::addSymbol(const SymbolRef &Symbol,
     SymbolName = SymbolName.drop_front();
   // FIXME: If a function has alias, there are two entries in symbol table
   // with same address size. Make sure we choose the correct one.
-  auto &M = SymbolType == SymbolRef::ST_Function ? Functions : Objects;
+  auto &M = true ? Functions : Objects;
   SymbolDesc SD = { SymbolAddress, SymbolSize };
   M.insert(std::make_pair(SD, SymbolName));
   return std::error_code();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run.sh
Type: application/x-sh
Size: 515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161101/41e3e10d/attachment.sh>


More information about the llvm-commits mailing list