Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory overrides for Profiling with +JPperf true #9500

Open
flamble opened this issue Feb 26, 2025 · 2 comments
Open

Directory overrides for Profiling with +JPperf true #9500

flamble opened this issue Feb 26, 2025 · 2 comments
Assignees
Labels
enhancement help wanted Issue not worked on by OTP; help wanted from the community team:VM Assigned to OTP team VM

Comments

@flamble
Copy link

flamble commented Feb 26, 2025

Is your feature request related to a problem? Please describe.
When using +JPperf true two types of file are created in /tmp. I would like to be able to place the files in a directory of my choice. The motivation is so that I can put them on a different mount from /tmp.

  1. jit-<pid>.dump

    char name[MAXPATHLEN];
    FileHeader header;
    /* LLVM places this file in ~/.debug/jit/ maybe we should do that to? */
    erts_snprintf(name, sizeof(name), "/tmp/jit-%d.dump", getpid());

  2. perf-<pid>.map

    char name[MAXPATHLEN];
    size_t namesz = sizeof(name);
    if (erts_sys_explicit_host_getenv("ERL_SYM_MAP_FILE", name, &namesz) !=
    1) {
    snprintf(name, sizeof(name), "/tmp/perf-%i.map", getpid());
    }

You can already use ERL_SYM_MAP_FILE to override the map filename (not just the directory):

  • No such override is there for the jit files
  • It would be useful if the existing filenames could be used, but an override could place the files in a different directory.

Describe the solution you'd like

For both types of file, the ability to override the directory. Using the jit file as an example:

        char* dirName;
        if (!(dirName = getenv("ERL_PERF_DIR"))) {
            dirName = "/tmp";
        }

        erts_snprintf(name, sizeof(name), "%s/jit-%d.dump", dirName, getpid());

Describe alternatives you've considered

  • Same variable name for both or individual variables for each file type
  • Making use of more standard variables like TMP/TMPDIR

Additional context

Please let me know if you'd prefer to solve this another way, or if there's a preference/guidelines you follow with environment variable usage/naming. I am happy to test + PR this once the naming/suggestion is agreed. Thanks!

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Mar 3, 2025
@jhogberg jhogberg added the help wanted Issue not worked on by OTP; help wanted from the community label Mar 3, 2025
@garazdawi garazdawi removed the help wanted Issue not worked on by OTP; help wanted from the community label Mar 3, 2025
@garazdawi
Copy link
Contributor

Hello!

In general we do not want to use environment variables for configurting how erts should run, so it would be bettere if this is a command line option. I think +JPperfdirectory <directory> is a good enough name :) A PR adding it + docs + tests would be welcome.

We used the environment variable ERL_SYM_MAP_FILE because it is an internal API only to be used by cerl.

@garazdawi garazdawi added the help wanted Issue not worked on by OTP; help wanted from the community label Mar 3, 2025
@flamble
Copy link
Author

flamble commented Mar 5, 2025

Thanks @garazdawi - I'll make a change as suggested, with +JPperfdirectory <directory>.

We used the environment variable ERL_SYM_MAP_FILE because it is an internal API only to be used by cerl.

makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted Issue not worked on by OTP; help wanted from the community team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

4 participants