<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Consolas",serif;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">I don't think I wrote a doc on this. 'compiler-rt/test/profile/instrprof-order-file.test' shows how to use it, build the app with -forder-file-instrumentation and -mllvm -orderfile-write-mapping, then run the app, use the mapping file to
decode the profile.<br>
<br>
The profile should be in default.profraw.order. But you can change its name via:<br>
<br>
- Writes to the file with the last name given to \a *<br>
- __llvm_profile_set_filename(),<br>
- or if it hasn't been called, the \c LLVM_PROFILE_FILE environment variable,<br>
- or if that's not set, the last name set to INSTR_PROF_PROFILE_NAME_VAR,<br>
- or if that's not set, \c "default.profraw".<br>
<br>
Hope this helps!<br>
Manman<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Jack Chen <jacklcc@google.com><br>
<b>Date: </b>Thursday, September 23, 2021 at 1:05 AM<br>
<b>To: </b>llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org><br>
<b>Cc: </b>Manman Ren <mren@fb.com><br>
<b>Subject: </b>How to use -forder-file-instrumentation to generate order file for iOS Apps?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal">Hello llvm developers,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I wonder how to use the flag <b>-forder-file-instrumentation</b> for iOS Apps written in objective-C and swift?<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I enabled the flags<b> -forder-file-instrumentation -mllvm -orderfile-write-mapping</b> <b>-fprofile-instr-generate
</b>when building my iOS App, which is written in objective-C and swift. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">After running the App on the iOS simulator on my macbook, a profraw.order file is generated in the simulator's folder. However, the file doesn't contain the correct contents. It contains too few bytes, also most data blobs are 32 bits (I
believe the right format is 64-bits MD5), and many of them are duplicated. FWIW, here are the first few bytes:<o:p></o:p></p>
</div>
</div>
<div>
<pre style="white-space:pre-wrap"><span style="color:black">00000000: 70aa cb11 0100 0000 f8ac cb11 0100 0000 p...............<o:p></o:p></span></pre>
<pre><span style="color:black">00000010: 90ab cb11 0100 0000 58aa cb11 0100 0000 ........X.......<o:p></o:p></span></pre>
<pre><span style="color:black">00000020: ffff ffff 0000 0000 0000 0000 0000 0000 ................<o:p></o:p></span></pre>
<pre><span style="color:black">00000030: 0000 0000 0000 0000 ffff ffff 0000 0000 ................<o:p></o:p></span></pre>
<pre><span style="color:black">00000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................<o:p></o:p></span></pre>
<pre><span style="color:black">00000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................<o:p></o:p></span></pre>
<pre><span style="color:black">00000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................<o:p></o:p></span></pre>
<pre><span style="color:black">00000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................<o:p></o:p></span></pre>
<pre><span style="color:black">00000080: 0000 0000 0000 0000 0000 0000 0000 0000 ................<o:p></o:p></span></pre>
</div>
<div>
<p class="MsoNormal">I wonder if the feature <b>-forder-file-instrumentation </b>is supported for iOS Apps that are written in objective-C and swift? <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">If yes, then I wonder what's the proper steps to use it?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you very much for your time.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Jack<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>