# prof-src-root, Qprof-src-root

Lets you use relative directory paths when looking up profile data and specifies a directory as the base.

## Syntax

Linux: | -prof-src-root=dir

macOS: | -prof-src-root=dir

Windows: | /Qprof-src-root:dir

## Arguments

dir | Is the base for the relative paths.

## Default

OFF | The setting of relevant options determines the path used when looking up profile data records.

## Description

This option lets you use relative directory paths when looking up profile data in .dpi files. It lets you specify a directory as the base. The paths are relative to a base directory specified during the [Q]prof-gen compilation phase.

This option is available during the following phases of compilation:

- Linux* and macOS systems: -prof-gen and -prof-use phases

- Windows* systems: /Qprof-gen and /Qprof-use phases

When this option is specified during the [Q]prof-gen phase, it stores information into the .dyn or .dpi file. Then, when .dyn files are merged together or the .dpi file is loaded, only the directory information below the root directory is used for forming the lookup key.

When this option is specified during the [Q]prof-use phase, it specifies a root directory that replaces the root directory specified at the [Q]prof-gen phase for forming the lookup keys.

To be effective, this option or option [Q]prof-src-root-cwd must be specified during the [Q]prof-gen phase. In addition, if one of these options is not specified, absolute paths are used in the .dpi file.

## IDE Equivalent

None

## Alternate Options

None

## Example

Consider the initial [Q]prof-gen compilation of the source file c:\user1\feature_foo\myproject\common\glob.c shown below:

    Windows*: icl /Qprof-gen /Qprof-src-root=c:\user1\feature_foo\myproject -c common\glob.c

    Linux* and macOS: icc -prof-gen -prof-src-root=c:\user1\feature_foo\myproject -c common\glob.c

For the [Q]prof-use phase, the file glob.c could be moved into the directory c:\user2\feature_bar\myproject\common\glob.c and profile information would be found from the .dpi when using the following:

    Windows*: icl /Qprof-use /Qprof-src-root=c:\user2\feature_bar\myproject -c common\glob.c

    Linux* and macOS: icc -prof-use -prof-src-root=c:\user2\feature_bar\myproject -c common\glob.c

If you do not use option [Q]prof-src-root during the [Q]prof-gen phase, by default, the [Q]prof-use compilation can only find the profile data if the file is compiled in the c:\user1\feature_foo\my_project\common directory.

Parent topic: Profile Guided Optimization Options

## See Also

prof-gen, Qprof-gen compiler option
prof-use, Qprof-use compiler option
prof-src-dir, Qprof-src-dir compiler option
prof-src-root-cwd, Qprof-src-root-cwd compiler option