Compile Unit Attribution (iOS)

📘

Linkmaps required

This feature requires xcarchives with linkmaps included in the upload.

At the top level, iOS debug information breaks down binaries into compile units. These units typically correspond to a source file, and include code compiled from the source file or other files within the same module. Emerge uses debug information in dSYMs and Linkmaps to provide a breakdown of how much app size can be attributed to each compile unit or object file.

This feature is exposed through a json file in the API, and is most useful for large teams looking to run custom analysis and attribution of the data. For example, you might use your source code owners to attribute code size to teams or features.

Accessing Data

To retrieve the compile unit attribution json, call the buildDetails API and access the moduleAttributionURL key in the response. This is a URL that you can use to download the full attribution file.

The file contains a path/size for each mapping we find in your debug information. For example:

[
{
  path: 'MyApp.app/MyApp',
  results: [{
    path: '.../src/MySourceFile.m',
    size: 100
  },
  {
    path: '.../src/MySourceFile2.m',
    size: 50
  }]
},
...
]

Compile Units and Object Files

Size is first attributed to compile units, but there isn't always a compile unit available. Third party code may be linked to your app but not include debug information in the dSYM file. In this case we fallback to providing the object file path, which could look like ThirdPartyLib.a or ThirdParty/SourceFile.o.

Unattributable Size

Some of the binary won't be attributed to a source file or object file. This includes some outlined code. Due to link time optimizations, outlined code can originate from multiple object files and have no single source to use for attribution. Other data in the app like __unwind_info and __LINKEDIT is generated by the linker or additional tools like code signing, not from a source file.

These will not be included in the attribution breakdown which is why the total size of elements in your app attribution will be less than the total binary size.