<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 15, 2017 at 1:34 PM, Rong Xu <span dir="ltr"><<a href="mailto:xur@google.com" target="_blank">xur@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Usleep() is in milliseconds.</div></blockquote><div><br></div><div><br></div><div> The  usleep()  function  suspends execution of the calling</div><div>       process for usec microseconds.  The sleep may  be  length-</div><div>       ened  slightly by any system activity or by the time spent</div><div>       processing the call.</div><div><br></div><div><br></div><div>Also:</div><div><br></div><div><div>4.3BSD, POSIX.1-2001. POSIX.1-2001 declares this function obsolete; use nanosleep(2) instead. POSIX.1-2008 removes the specification of usleep().</div><div><br></div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto"><br><div dir="auto">As for the check, parent should get to the profile dump first as it sleeps  for 10ms. 80MB profile take 1 second to write. We should get the merged profile in any system with rasonable scheduler.</div><div dir="auto"><br></div></div></div></blockquote><div><br></div><div>but the test can not depend on the timing.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto"><div dir="auto"></div><div dir="auto">I did not use 0 size check also because I don't find the support in FileCheck. I would need to use a shell command for this.</div></div></div></blockquote><div><br></div><div>you can use llvm-profdata show command on empty file -- it will give error message.</div><div><br></div><div><br></div><div>David</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto"><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div></div></div><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Feb 15, 2017 1:22 PM, "David Li via Phabricator" <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">davidxl added inline comments.<br>
<br>
<br>
================<br>
Comment at: test/profile/Linux/prctl.c:17<br>
+int main(int argc, char **argv)<br>
+{<br>
+    pid_t pid = fork();<br>
----------------<br>
format the test in llvm style.<br>
<br>
<br>
================<br>
Comment at: test/profile/Linux/prctl.c:23<br>
+        int sum = 0;<br>
+        /* child process: sleep 50ms and get to runtime before the<br>
+         * main process exits. */<br>
----------------<br>
50 us or microsec<br>
<br>
<br>
================<br>
Comment at: test/profile/Linux/prctl.c:33<br>
+    {<br>
+        /* parent process: sleep 10ms to get into profile runtime first. */<br>
+        usleep(10);<br>
----------------<br>
10us<br>
<br>
<br>
================<br>
Comment at: test/profile/Linux/prctl.c:40<br>
+// CHECK: Total functions: 1<br>
+// CHECK: Maximum function count: 5000<br>
+// CHECK: Maximum internal block count: 1<br>
----------------<br>
Just check size of profile data? It is not guaranteed that child process will have a chance to dump.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D29954" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2995<wbr>4</a><br>
<br>
<br>
<br>
</blockquote></div></div>
</div></div></blockquote></div><br></div></div>