Skip to content

Instantly share code, notes, and snippets.

@ceejbot
Last active August 14, 2023 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ceejbot/aaab26f456a6f7d0e981f248c76048a7 to your computer and use it in GitHub Desktop.
Save ceejbot/aaab26f456a6f7d0e981f248c76048a7 to your computer and use it in GitHub Desktop.
some automation for the profiling steps
# If you don't know what this is, go to https://just.systems
set windows-shell := ["pwsh.exe", "-Command"]
modpath := "G:/VortexStaging/Community Shaders development/SKSE/Plugins/"
# How to get started profiling.
@help:
"First, add the following directories to your path env var:"
"C:\Program Files\Microsoft Visual Studio\2022\Community\Team Tools\Performance Tools\"
"C:\Program Files\Microsoft Visual Studio\2022\Community\Team Tools\DiagnosticsHub\Collector\"
""
"Next you need to build with profiling turned on. Ceej has not yet built a cmake config for"
"this, but you can set it up by hand. Go to the project properties and look at the "
"linker settings. Turn off incremental linking. Turn on /PROFILE . "
"Do a clean build. Then run the instrument and deploy just recipes."
"Follow instructions from there."
""
just --list
# Instrument the dll for profiling.
@instrument:
vsinstr.exe build/RelWithDebInfo/CommunityShaders.dll
# Copy dlls to the live development mod for profiling/testing.
@deploy:
"Copying build artifacts to {{modpath}}..."
Copy-Item build/RelWithDebInfo/CommunityShaders.dll -Destination "{{modpath}}"
Copy-Item build/RelWithDebInfo/CommunityShaders.pdb -Destination "{{modpath}}"
"Now launch Skyrim and note its PID. When you're ready to profile, run 'just profile-start <PID>'."
# Attach to a running Skyrim process and collect data.
@profile-start PID:
VSDiagnostics.exe start 1 /attach:{{PID}} /loadConfig:CpuUsageWithCallCounts.json
"Now switch to the game and do things. When you're finished, quit and run 'just profile-stop'"
# Stop profiling.
@profile-stop OUTPUT="profile.diagsession":
VSDiagnostics.exe stop 1 /output:{{OUTPUT}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment