sudara / melatonin_perfetto

Use google's perfetto performance tracing in JUCE plugins and apps
45 stars 8 forks source link

Add tests verifying PERFETTO value #12

Closed sudara closed 1 year ago

sudara commented 1 year ago

Resolves #9

sudara commented 1 year ago

Looking good!

The python file seems to have that same whitespace issue we were seeing on other PRs and windows looks like it's failing a test....

benthevining commented 1 year ago

What whitespace issue? Should I be using spaces instead of tabs?

sudara commented 1 year ago

@benthevining Since the repo was with spaces, maybe makes sense to be consistent vs. mix them, but I was referring to this. Haven't checked out the branch locally to see if it's just a github rendering issue or not:

Arc - 2023-01-26 25@2x

benthevining commented 1 year ago

That's a Github rendering issue, since that file currently uses tabs. I'll convert it to spaces.

benthevining commented 1 year ago

The Windows test failure is due to this build error:

Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Checking File Globs
  perfetto.vcxproj -> C:\Users\benth\Documents\melatonin_perfetto\Builds\Debug\perfetto.lib
  melatonin_perfetto.cpp
C:\Users\benth\Documents\melatonin_perfetto\melatonin_perfetto\melatonin_perfetto.cpp(4,1): error C2766: explicit speci
alization; 'static_state_' has already been defined [C:\Users\benth\Documents\melatonin_perfetto\Builds\tests\PerfettoV
alue\PerfettoValueTest.vcxproj]
C:\Users\benth\Documents\melatonin_perfetto\melatonin_perfetto\melatonin_perfetto.h(30): message : see previous definit
ion of 'private: static perfetto::internal::DataSourceStaticState perfetto::DataSource<perfetto::TrackEvent,perfetto::i
nternal::TrackEventDataSourceTraits>::static_state_' [C:\Users\benth\Documents\melatonin_perfetto\Builds\tests\Perfetto
Value\PerfettoValueTest.vcxproj]
  juce_core.cpp
  Generating Code...

Do you have any ideas about this?

sudara commented 1 year ago

Dang, thought I wrote you back yesterday, sorry about that. I actually don't have any idea on that, haven't seen it before. Is it possible melatonin_perfetto is being included twice on a test somehow?

benthevining commented 1 year ago

Hmm... I'm not sure. It's curious that this issue only happens on Windows and not Mac.

benthevining commented 1 year ago

I can re-examine all the CMake to check for something like that, but otherwise, I'm tempted to report this as a Perfetto bug...

sudara commented 1 year ago

The issue only bubbles up in the one particular test melatonin.perfetto.PERFETTO_symbol_value? It looks like those cpp files also include melatonin_perfetto.h, maybe that's not necessary?

benthevining commented 1 year ago

I suspect this issue would happen in any project that consumes melatonin_perfetto, but I haven't tested that theory yet.

That cpp file needs to include the module header to get the default PERFETTO symbol definition, that's the whole idea of that test

sudara commented 1 year ago

Ah, perhaps the problem is this macro is needed in a cpp file: https://github.com/sudara/melatonin_perfetto/blob/534389e91c5879ff5c98e0498d5c8434ed2f3466/melatonin_perfetto/melatonin_perfetto.cpp#L4

benthevining commented 1 year ago

Right, but the test app links to the module, so it gets that cpp file. The error I get is:

C:\Users\benth\Documents\melatonin_perfetto\melatonin_perfetto\melatonin_perfetto.cpp(4,1): error C2766: explicit speci
alization; 'static_state_' has already been defined

I've reviewed all the CMake, and nothing is being linked or added twice, everything in the module set up looks correct to me. I wonder if any other Perfetto users have ever reported something similar...

benthevining commented 1 year ago

I've filed this issue at the Perfetto repo to see if anyone has ever seen a similar error.

sudara commented 1 year ago

See: https://github.com/google/perfetto/issues/214

benthevining commented 1 year ago

Ah, brilliant, great find! I can add the /permissive- flag as a workaround until this is fixed in MSVC. (Looks like they reported it fixed, but people are still reporting errors.)

I'll test it out now, and commit if it works...

benthevining commented 1 year ago

The build and tests succeed on my Windows machine with the /permissive- flag added, so I've pushed that fix, let's hope the CI succeeds...

sudara commented 1 year ago

Awesome, thanks for putting comments in there. Going to test failure...

benthevining commented 1 year ago

Both Mac and Windows tests failed after that commit, which is the behavior we expect. I've now reverted that commit (so the default value of PERFETTO is now 0 again).

The last thing left on my to-do list is to test that dump files are created, but other than that, I think this PR is ready to be merged.

sudara commented 1 year ago

Thanks for that! Wasn't sure if you wanted to merge this or add the file test, I'll let you wrap that up!

benthevining commented 1 year ago

I'll merge this PR now and open a new one for the dump file creation test.