Skip to content

Conversation

@nickclark2016
Copy link
Member

@nickclark2016 nickclark2016 commented Mar 13, 2025

What does this PR do?

Adds an API for enabling instrumented profiling in gcc, clang, cosmocc, and msc, as well as the Visual Studio exporter.

How does this PR change Premake's behavior?

No breaking changes. Only a functionality add.

Anything else we should know?

N/A

Did you check all the boxes?

  • Focus on a single fix or feature; remove any unrelated formatting or code changes
  • Add unit tests showing fix or feature works; all tests pass
  • Mention any related issues (put closes #XXXX in comment to auto-close issue when PR is merged)
  • Follow our coding conventions
  • Minimize the number of commits
  • Align documentation to your changes

You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to requests like these!

@nickclark2016 nickclark2016 requested a review from a team March 13, 2025 16:01
Copy link
Collaborator

@redorav redorav left a comment

Choose a reason for hiding this comment

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

So it's both a property in the property sheet and a manually set flag? Sounds a bit of an odd setup but I guess that's the way it works, looks good to me

@nickclark2016
Copy link
Member Author

So it's both a property in the property sheet and a manually set flag? Sounds a bit of an odd setup but I guess that's the way it works, looks good to me

Can you elaborate? This is something that we can set via the MSBuild API and if we are using msc from a non Visual Studio exporter.

@redorav
Copy link
Collaborator

redorav commented Mar 13, 2025

Ah it's like a part of it goes to the program database file (the pdb I guess) where it's set on the property pages and another part is set in the linker with a manual /PROFILE flag

@nickclark2016
Copy link
Member Author

The "msc.lua" is completely separate from the VS exporter. They both pipe data to the linker.

@redorav
Copy link
Collaborator

redorav commented Mar 13, 2025

Ah I see, I misunderstand many parts of Premake still

Copy link
Contributor

@Jarod42 Jarod42 left a comment

Choose a reason for hiding this comment

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

Would it be -pg flags for gcc/clang to be usable with gprof?

table.insert(flags, '/NODEFAULTLIB:' .. ignore)
end

-- If the type is ConsoleApp, WindowedApp, or SharedLib and PROFILE is set, add the appropriate flag.
Copy link
Contributor

Choose a reason for hiding this comment

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

I find that kind of comment useless, it just repeats the below code (which is clear).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I wrote the comment for myself before writing all the code. Will remove.

@nickclark2016
Copy link
Member Author

Would it be -pg flags for gcc/clang to be usable with gprof?

I completely forgot about this flag. I'll need to investigate where all this would need to go.

@nickclark2016 nickclark2016 changed the title Added the PROFILE flag for msc and Visual Studio Added Instrumented Profiling Support Mar 15, 2025
@nickclark2016 nickclark2016 merged commit 52dd858 into premake:master Mar 25, 2025
49 checks passed
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.

4 participants