Skip to content

fall back to system path for hotspot-perfparser - #780

Open
GitMensch wants to merge 1 commit into
KDAB:masterfrom
GitMensch:patch-1
Open

GitMensch wants to merge 1 commit into
KDAB:masterfrom
GitMensch:patch-1

Conversation

@GitMensch

Copy link
Copy Markdown
Contributor

... if HOTSPOT_PERFPARSER not set and not found in libexec

this eases especially the use of static hotspot + hotspot-perfparser, as in that case those are the only two distributed elements

... if HOTSPOT_PERFPARSER not set and not found in libexec
@fifbroman8

Copy link
Copy Markdown

Never mind. I will complie perfparser into hotspot. See https://github.com/fifbroman8/hotspot-bin/blob/main/demangle.patch

@GitMensch

Copy link
Copy Markdown
Contributor Author

I don't think that perfparser should be a GUI application also not in your fork.
his initializes X11 and other display envs - which is bad if you do a hotspot --exportTo your.perfparser perf.data

Also this PR is not only relevanbt for your fork but intended to easily use the binary in other cases as well.

@GitMensch

Copy link
Copy Markdown
Contributor Author

... also: I'd like to see a PR here that takes the "initial" demangler approach: using libiberty, when possible, and only if this isn't the case fallback to demangler plugins (not sure if the existing ones should be completely removed and libiberty made a hard dependency)

Comment thread src/util.cpp
return QStandardPaths::findExecutable(parserBinary);
}
// common option: find binary by configured libexec
parserBinary = Util::findLibexecBinary(QStringLiteral("hotspot-perfparser"));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the string literal won't be deduped by the compiler, so please introduce a local. since you'll then have to touch this PR anyhow, please consider changing the code in the following way, which I subjectively find nicer:

// prefer configured one (returns an error in the caller if invalid)
if (const auto perfparser = qEnvironmentVariable("HOTSPOT_PERFPARSER"); !perfparser.isEmpty()) {
    return QStandardPaths::findExecutable(perfparser);
}

const auto hotspotPerfparser = QStringLiteral("hotspot-perfparser");

// common option: find binary by configured libexec
if (const auto parserBinary = Util::findLibexecBinary(hotspotPerfparser); !parserBinary.isEmpty()) {
    return parserBinary;
}

// fallback: try system paths
return QStandardPaths::findExecutable(hotspotPerfparser);

@fifbroman8

Copy link
Copy Markdown

I don't think that perfparser should be a GUI application also not in your fork. his initializes X11 and other display envs - which is bad if you do a hotspot --exportTo your.perfparser perf.data

Also this PR is not only relevanbt for your fork but intended to easily use the binary in other cases as well.

When linking into one executable, perfparser should have GUI because some kf6 modules has auto-initialization and will crash with QCoreApplication only.

@GitMensch

Copy link
Copy Markdown
Contributor Author

When linking into one executable, perfparser should have GUI because some kf6 modules has auto-initialization and will crash with QCoreApplication only.

Then I highly suggest to keep both binaries separate - and with this PR which already has the "ok feature-wise" from Milian it will be even easier to have both directly next to each other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants