Page 1 of 1

How to API Trace

Posted: 01 Dec 2018, 21:12
by Ravenwing
I've been trying to help AnyOldName3 diagnose a problem with the shadows branch and had to run an APITrace for him. As I'm sure many besides me also don't know how to run one, here's a short guide on how to do so. If anyone wants to add to the wiki, feel free, but it's pretty low on my list of priorities, so I probably won't be doing it. This is Windows specific, but hopefully will help others as well.

APITrace is a set of tools that will record all the graphics related calls OpenMW makes. This makes it easier to diagnose a problem as someone can read through exactly what the engine was trying to do at the time of a problem.

You can download APITrace here: http://apitrace.github.io/

In the download, find the binary in:

Code: Select all

...\apitrace-msvc\x64\bin\qapitrace.exe
The trick is to add this to your system paths so you can run it directly from PowerShell.
Do that by following this guide and adding the path up to ...\bin to Paths.

Now all you have to do is open PowerShell. Change your working directory to the location of openmw.exe using the "cd" command. For example:

Code: Select all

cd "G:\Program Files\OpenMW 0.44.0"
Quotes are necessary if you have spaces in your path. PowerShell should now reflect that you're in this directory. Now simply type:

Code: Select all

qapitrace.exe
The GUI for APITrace should now be open and you can make a new trace by going to new and selecting openmw.exe as the application. No arguments are needed. This will open OpenMW, but may take longer than normal. Then simply go through and recreate your graphics issue in game. Once you exit, the trace will be automatically saved to the OpenMW folder you were working in.

You can send this to whoever asked for it so they can try and diagnose the issue. Be warned, it's much larger than most places will allow you to post, so I had to make a shared folder on Google Drive and send him the link.

Hope this helps!

Re: How to API Trace

Posted: 02 Dec 2018, 02:29
by AnyOldName3
Note: if you only think you're ever going to have to do this a few times, it might be easier to add APITrace to the system path variable from within PowerShell just for that one session with

Code: Select all

$env:Path = "path\to\apitrace;$env:Path"
Also, you can open PowerShell directly in a specific folder by holding shift and right-clicking on some empty space within the folder, then selecting "Open PowerShell window here"

Re: How to API Trace

Posted: 02 Dec 2018, 05:31
by Ravenwing
Good info, thanks AnyOldName3! Although I suspect I’ll be able to use it to help in the future. If anyone else has any suggestions, feel free to post them here!

Re: How to API Trace

Posted: 03 Dec 2018, 16:05
by silentthief
Powershell is a win 10 thingy, right? Or is that something that win 7 can do?

ST

Re: How to API Trace

Posted: 03 Dec 2018, 16:40
by Lagahan
silentthief wrote:
03 Dec 2018, 16:05
Powershell is a win 10 thingy, right? Or is that something that win 7 can do?
Windows 7 has Powershell 2.0 built in, I believe its 4.0 or 5.0 by default Windows 10. You could probably run this from command prompt as well though if the .exe for APITrace was in your environment path.

Re: How to API Trace

Posted: 03 Dec 2018, 16:47
by AnyOldName3
The only difference between how this would work with CMD and PowerShell is that where PowerShell uses

Code: Select all

$env:Path = "path\to\apitrace;$env:Path"
CMD uses

Code: Select all

set PATH=path\to\apitrace;%PATH%
One of the updates for Windows 10 changed the default from CMD to PowerShell, but for basic tasks like this, there's not much difference between them.

Re: How to API Trace

Posted: 19 Dec 2018, 15:40
by lysol
I made this thread a sticky for future viewers.