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

Add Tracy, a frame profiler #3118

Closed
wants to merge 11 commits into from
Closed

Conversation

Pirulax
Copy link
Contributor

@Pirulax Pirulax commented Jul 12, 2023

Adds Tracy v0.9.1: A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler

I've added tracing to quite a few functions.
Updated the readme with instructions on how to use Tracy. [TODO]

The performance impact isn't too bad.

To test, just download the Tracy v0.9.1 server from here
We're using v0.9.1 in particular because I'm too lazy to compile the latest Tracy server.

I'd like to use submodules, but not sure if our current infrastructure would work with it.
I also get linker errors when enabling the callstack feature (Regarding RtlWalkStackChain), so if someone knows what the issue is, pls fix it, ty.

A possible issue could be security, as tracy must be in a separate dll, and uses sockets to communicate.

NOTE:
When connecting to the client [from the tracy server] first connect to an MTA server asTracy really doesn't like modules being unloaded while it's running [and it's going to crash].

@tederis
Copy link
Collaborator

tederis commented Jul 13, 2023

Nice. I have been using it for at least 3 years with MTA. But you should be aware of the macro TRACY_ON_DEMAND. Without using it a profiler will spend all the process memory in situations when it has no connections.

@Pirulax
Copy link
Contributor Author

Pirulax commented Jul 13, 2023

Ah, so you've been using it with MTA.
I kinda have trouble getting it to compile with callstack support, it's missing an external symbol. __tracy_RtlWalkStackChain [or whatever the fuck the name is].
No clue how to solve it. Mind showing your premake for it?

@tederis
Copy link
Collaborator

tederis commented Jul 14, 2023

Nothing special:

project "Tracy"
	language "C++"
	kind "StaticLib"
	targetname "tracy"

	defines { "TRACY_ENABLE=1", "TRACY_ON_DEMAND" }

	vpaths {
		["Headers/*"] = "**.h",
		["Headers/*"] = "**.hpp",
		["Sources/*"] = "**.cpp",
		["*"] = "premake5.lua"
	}

	files {
		"premake5.lua",
		"*.h",
		"*.hpp",
		"*.cpp"
	}

@tederis
Copy link
Collaborator

tederis commented Jul 14, 2023

Okay, I just tried out your branch. From what I can see, the problem is you're exporting DLL in all projects even when import is being required. You should remove workspace "*" from vender/tracy/premake5.lua and manually add these macros in every project that uses Tracy. Every project except the profiler itself must contain TRACY_IMPORTS macro.

@tederis
Copy link
Collaborator

tederis commented Jul 14, 2023

I also saw an error C2065: 'ZoneScoped', but the solution is trivial I guess(add missing headers to PCHs).

@Pirulax
Copy link
Contributor Author

Pirulax commented Jul 15, 2023

So I can't be lazy.
I also wonder if there's a better solution than adding that macro to every project I want to use tracy in manually?
CMake seems to just work, so there must be a good solution in premake too, no?

@botder
Copy link
Member

botder commented Jul 15, 2023

I also wonder if there's a better solution than adding that macro to every project I want to use tracy in manually?

Premake doesn't support that. CMake propagates requirements of a target to dependents automatically.

Adding Tracy is a good idea.

@lopezloo lopezloo added the enhancement New feature or request label Jul 18, 2023
@Pirulax
Copy link
Contributor Author

Pirulax commented Nov 13, 2023

Okay Ill work on this soon
Won't be adding server profiling for now, I don't think that's necessary yet.

@Pirulax Pirulax marked this pull request as draft January 8, 2024 22:11
@github-actions github-actions bot added the stale Inactive for over 90 days, to be closed label Apr 9, 2024
Copy link
Contributor

github-actions bot commented Apr 9, 2024

This draft pull request is stale because it has been open for at least 90 days with no activity. Please continue on your draft pull request or it will be closed in 30 days automatically.

@github-actions github-actions bot closed this May 9, 2024
Copy link
Contributor

github-actions bot commented May 9, 2024

This draft pull request was closed because it has been marked stale for 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale Inactive for over 90 days, to be closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants