[llvm-dev] How to use -forder-file-instrumentation to generate order file for iOS Apps?

Manman Ren via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 23 14:20:53 PDT 2021


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.

The profile should be in default.profraw.order. But you can change its name via:

- Writes to the file with the last name given to \a *
- __llvm_profile_set_filename(),
- or if it hasn't been called, the \c LLVM_PROFILE_FILE environment variable,
- or if that's not set, the last name set to INSTR_PROF_PROFILE_NAME_VAR,
- or if that's not set,  \c "default.profraw".

Hope this helps!
Manman


From: Jack Chen <jacklcc at google.com>
Date: Thursday, September 23, 2021 at 1:05 AM
To: llvm-dev at lists.llvm.org <llvm-dev at lists.llvm.org>
Cc: Manman Ren <mren at fb.com>
Subject: How to use -forder-file-instrumentation to generate order file for iOS Apps?
Hello llvm developers,

I wonder how to use the flag -forder-file-instrumentation for iOS Apps written in objective-C and swift?

I enabled the flags -forder-file-instrumentation -mllvm -orderfile-write-mapping -fprofile-instr-generate when building my iOS App, which is written in objective-C and swift.
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:

00000000: 70aa cb11 0100 0000 f8ac cb11 0100 0000  p...............

00000010: 90ab cb11 0100 0000 58aa cb11 0100 0000  ........X.......

00000020: ffff ffff 0000 0000 0000 0000 0000 0000  ................

00000030: 0000 0000 0000 0000 ffff ffff 0000 0000  ................

00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................

00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................

00000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................

00000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................

00000080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
I wonder if the feature -forder-file-instrumentation is supported for iOS Apps that are written in objective-C and swift?
If yes, then I wonder what's the proper steps to use it?

Thank you very much for your time.

Regards,
Jack

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210923/56b0a398/attachment.html>


More information about the llvm-dev mailing list