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

peek into file before open #539

Merged
merged 4 commits into from
Dec 10, 2023
Merged

peek into file before open #539

merged 4 commits into from
Dec 10, 2023

Conversation

GitMensch
Copy link
Contributor

  • check file open, providing nice and early error
  • explicit check for perfparser (magic number QPERFSTREAM) opening directly without the need to fall back to file name
  • explicit check for V1 perf data which isn't supported by perfparser
  • explicit check for unknown file type

Fixes: #477

Copy link
Member

@milianw milianw left a comment

Choose a reason for hiding this comment

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

one minor issue, otherwise lgtm

src/parsers/perf/perfparser.cpp Outdated Show resolved Hide resolved
@GitMensch

This comment was marked as resolved.

@milianw
Copy link
Member

milianw commented Oct 29, 2023

So should I capitalize Unknown?

yes, and the second message in the middle too. ideally, rephrase it to the more terse

Unsupported V1 perf data

@GitMensch
Copy link
Contributor Author

GitMensch commented Oct 30, 2023

I've started to add some tests. I can already use the tests/integrationtests/custom_cost_aggregation_testfiles/custom_cost_aggregation.perfparser file (use it both under its original name and copy it to a local file "fruitper" (opening works as expected in both cases), but I do miss a matching perf.data file.

Can you create and upload it (for later tests maybe multiple versions [with/without --call-graph + --sample-cpu])?

Do you have a PERFFILE (perf V1) anywhere [or even a Linux < 3.7 to create it]? I've only hex-edited a text-file, to trigger that message so far.

@GitMensch

This comment was marked as outdated.

@GitMensch GitMensch force-pushed the peak-file branch 3 times, most recently from 1f5e434 to f41fe8e Compare November 1, 2023 07:29
@GitMensch

This comment was marked as outdated.

@GitMensch GitMensch requested a review from milianw November 1, 2023 07:30
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
@GitMensch GitMensch force-pushed the peak-file branch 2 times, most recently from 7fccf85 to 4ffef0b Compare November 3, 2023 00:25
@GitMensch
Copy link
Contributor Author

GitMensch commented Nov 3, 2023

Requested changes done, PERFv1 and PERFv2 added, fixed opening of perf.data.gz (now also covered by the testsuite).
Is there more to do than handling the clazy waning (about now unused this as we use the decompressIfNeeded now outside of the lambda)?

@GitMensch

This comment was marked as resolved.

.gitignore Outdated Show resolved Hide resolved
@GitMensch

This comment was marked as resolved.

tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Show resolved Hide resolved
@GitMensch
Copy link
Contributor Author

GitMensch commented Nov 7, 2023

lol, clang_lazy complains about QTRY_COMPARE_WITH_TIMEOUT (which is also used by QTRY_COMPARE, just with the default timeout 5000) to use QString::fromUtf8("QTestLib: This test case check (\"%1\") failed because the requested timeout (%2 ms) was too short, %3 ms would have been sufficient this time."); instead of QStringLiteral. The only option to solve that would to tinker with the QT macro or completely refrain from using it, ... or disable the Wclazy-qstring-allocations warning, which is possibly also doable for that single macro or at least function.

@milianw
Copy link
Member

milianw commented Nov 7, 2023

lol, clang_lazy complains about QTRY_COMPARE_WITH_TIMEOUT

odd bug, esp. considering we do -isystem /usr/include/qt - I'll investigate and potentially update clazy or so. we can ignore that for now - but there are two little nits I'd like to see fixed first please

@milianw
Copy link
Member

milianw commented Nov 7, 2023

Any idea why:

* the ubuntu-2204 test environment does not include perf?

we cannot run perf properly anyways inside the VM I believe, though maybe the task-clock backend is good enough for some basic testing. generally, it's a tricky one to get working in a portable fashion - I am not very fond of it anymore. it breaks every other day, when we update the compiler, elfutils or perf...

* the test, that is not run at all, SIGSEGVs?

what test, backtrace?

@GitMensch

This comment was marked as outdated.

@GitMensch
Copy link
Contributor Author

lol, clang_lazy complains about QTRY_COMPARE_WITH_TIMEOUT

odd bug, esp. considering we do -isystem /usr/include/qt

I agree.

I'll investigate and potentially update clazy or so. we can ignore that for now

Thanks.

but there are two little nits I'd like to see fixed first please

Which ones? While learning about QT and its _data test was quite interesting, I'd really like to get that out of my view soon :-)

@milianw
Copy link
Member

milianw commented Nov 9, 2023

but there are two little nits I'd like to see fixed first please

Which ones? While learning about QT and its _data test was quite interesting, I'd really like to get that out of my view soon :-)

Don't you see the two review comments of mine?

@GitMensch

This comment was marked as outdated.

Copy link
Member

@milianw milianw left a comment

Choose a reason for hiding this comment

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

for some reasons these review changes didn't get published 🤷

tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Outdated Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Show resolved Hide resolved
tests/integrationtests/tst_perfparser.cpp Show resolved Hide resolved
@GitMensch
Copy link
Contributor Author

@milianw Just a friendly ping - Is there anything open with this or the other PRs from my side?

GitMensch and others added 4 commits December 10, 2023 12:14
* dropped unused headers
* COMPARE_OR_THROW -> QCOMPARE
* VERIFY_OR_THROW -> QVERIFY
* check file open, providing nice and early error
* explicit check for perfparser (magic number QPERFSTREAM)
  opening directly without the need to fall back to file name
* explicit check for V1 perf data which isn't supported by perfparser
* explicit check for unknown file type
This is fixed upstream in Qt 6.3+ so for now we just disable
the check in the test file where we run into it for Qt versions
lower than 6.3.
Copy link
Member

@milianw milianw left a comment

Choose a reason for hiding this comment

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

OK, I removed one more usage of QString::isNull and added a patch to disable the clazy issues to get the CI green again - let's see if that's really the case then this can be merged

tests/integrationtests/tst_perfparser.cpp Show resolved Hide resolved
@milianw
Copy link
Member

milianw commented Dec 10, 2023

yep, lgtm now, I'll merge it - thanks for your contribution and patience with me :)

@milianw milianw merged commit 233c027 into KDAB:master Dec 10, 2023
12 checks passed
@GitMensch GitMensch deleted the peak-file branch December 10, 2023 14:45
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.

recognize perfparser format (peek into file on open)
2 participants