Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4975 Discussions

How do I use VTune with a Source SDK (Half-Life2) Mod?

zgzg2020
Beginner
383 Views
Hello, this is my first post here. I hope I am in the right place.
I have read all the PDF files posted for Getting Started, and I couldn't find what I needed so I need to post to get an answer.

I am using a Modding kit for Half-Life2 named Source SDK for my research. And, I was planning on using your tool, VTune, to show me the Hotspots of the Mod. However, because Half-Life2 cannot run more than one instance on one computer, and because after running the Mod I need to manually type in commands to load maps and so forth, I am in a position where I need to run my application (eg Mod), and then when I am in the correct moment, switch back to VTune and tell it to begin sampling.
I've tried to follow the instructions in this tutorial, but it didn't work. Plus, the instructions there seem to be for an older version of VTune.

In short, I would like to ask, is there a way for me to tell VTune to do it's analysis without it needing to launch the program itself? I want to run my program manually, and then tell VTune to sample during run-time.

I have another more simpler question, I read some of the posts about VTune and Hotspots. But, when I run VTune, I don't get the cool Hotspot window on the right. I have to drill manually until I reach the Hotspot of an application.
0 Kudos
1 Solution
Thomas_W_Intel
Employee
383 Views
Quoting - zgzg2020
Hello, this is my first post here. I hope I am in the right place.
I have read all the PDF files posted for Getting Started, and I couldn't find what I needed so I need to post to get an answer.

I am using a Modding kit for Half-Life2 named Source SDK for my research. And, I was planning on using your tool, VTune, to show me the Hotspots of the Mod. However, because Half-Life2 cannot run more than one instance on one computer, and because after running the Mod I need to manually type in commands to load maps and so forth, I am in a position where I need to run my application (eg Mod), and then when I am in the correct moment, switch back to VTune and tell it to begin sampling.
I've tried to follow the instructions in this tutorial, but it didn't work. Plus, the instructions there seem to be for an older version of VTune.

In short, I would like to ask, is there a way for me to tell VTune to do it's analysis without it needing to launch the program itself? I want to run my program manually, and then tell VTune to sample during run-time.

I have another more simpler question, I read some of the posts about VTune and Hotspots. But, when I run VTune, I don't get the cool Hotspot window on the right. I have to drill manually until I reach the Hotspot of an application.

Hello,

The answer depends on if you want to do sampling or call-graph.

For sampling, the answer is pretty easy. Use the VTune wizard for sampling and when you are asked for the application to launch, select the check box "No application to launch" next to it. When you run the VTune measurement, VTune will monitor the activities system wide. You can therefore prepare everything and then kick off the measurement, when you come to the point that you are interested in. The time for the measurement can be changed in the properties of the VTune activity or you can end the measurement by pushing the "stop" button.

For a call-graph, VTune must start the application, because it does instrument the code before it is started. However, you have the possibilty to pause the measurements at start-up of the application, prepare everything, and then resume the measurement. What is important is that you add your DLL to the "modules of interest" when setting up the activity.

Kind regards
Thomas

View solution in original post

0 Kudos
7 Replies
Thomas_W_Intel
Employee
384 Views
Quoting - zgzg2020
Hello, this is my first post here. I hope I am in the right place.
I have read all the PDF files posted for Getting Started, and I couldn't find what I needed so I need to post to get an answer.

I am using a Modding kit for Half-Life2 named Source SDK for my research. And, I was planning on using your tool, VTune, to show me the Hotspots of the Mod. However, because Half-Life2 cannot run more than one instance on one computer, and because after running the Mod I need to manually type in commands to load maps and so forth, I am in a position where I need to run my application (eg Mod), and then when I am in the correct moment, switch back to VTune and tell it to begin sampling.
I've tried to follow the instructions in this tutorial, but it didn't work. Plus, the instructions there seem to be for an older version of VTune.

In short, I would like to ask, is there a way for me to tell VTune to do it's analysis without it needing to launch the program itself? I want to run my program manually, and then tell VTune to sample during run-time.

I have another more simpler question, I read some of the posts about VTune and Hotspots. But, when I run VTune, I don't get the cool Hotspot window on the right. I have to drill manually until I reach the Hotspot of an application.

Hello,

The answer depends on if you want to do sampling or call-graph.

For sampling, the answer is pretty easy. Use the VTune wizard for sampling and when you are asked for the application to launch, select the check box "No application to launch" next to it. When you run the VTune measurement, VTune will monitor the activities system wide. You can therefore prepare everything and then kick off the measurement, when you come to the point that you are interested in. The time for the measurement can be changed in the properties of the VTune activity or you can end the measurement by pushing the "stop" button.

For a call-graph, VTune must start the application, because it does instrument the code before it is started. However, you have the possibilty to pause the measurements at start-up of the application, prepare everything, and then resume the measurement. What is important is that you add your DLL to the "modules of interest" when setting up the activity.

Kind regards
Thomas
0 Kudos
TimP
Honored Contributor III
383 Views
If you can place the entire job in a script, you could set up VTune sampling to run the script.
0 Kudos
zgzg2020
Beginner
383 Views
I don't know the mechanism for replying to everyone, who replied to this thread.
I just want to say thank you for your prompt and very clear and informative response!!

Thanks guys!
0 Kudos
zgzg2020
Beginner
383 Views

For a call-graph, VTune must start the application, because it does instrument the code before it is started. However, you have the possibilty to pause the measurements at start-up of the application, prepare everything, and then resume the measurement. What is important is that you add your DLL to the "modules of interest" when setting up the activity.

Kind regards
Thomas
The sampling, goes quite smoothly, but I still don't understand the differences between choosing Event or Time.
As for call-graph, the game becomes EXTREMELY slow. And unfortunately not just that, when the game finishes, I click Stop in VTune, the game shuts down illfully. And, then the VTune displays a message, "No results were found for this run", anyway, the Output window says data collection successful, but I can't see the results...
Is it normal for the analyzed software to become VERY VERY slow? How do I speed it up? What is the proper configurations of VTune?
Why can't I see the Collected Data? Is there a limit I am exceeding or something?
---
I forgot to mention, it says in the console "skipped" to all of the DLLs relative to my game. Why is that? How do I fix it?
0 Kudos
TimP
Honored Contributor III
383 Views
Quoting - zgzg2020
The sampling, goes quite smoothly, but I still don't understand the differences between choosing Event or Time.
As for call-graph, the game becomes EXTREMELY slow.
Event based sampling should be more accurate, as well as giving you many more options. I think Time based is provided simply as a fall-back in case of need. In earlier versions it gave some generic processor support.
Call-graph "instruments" your application by adding code which slows it down.
Traditional call-graphing alternatives like gprof might be considered, when you are working from source code and can switch temporarily to a compiler which supports it. I don't know how you would get value from call-graph when you don't have the source code.
0 Kudos
Thomas_W_Intel
Employee
383 Views
Quoting - tim18
Event based sampling should be more accurate, as well as giving you many more options. I think Time based is provided simply as a fall-back in case of need. In earlier versions it gave some generic processor support.
Call-graph "instruments" your application by adding code which slows it down.
Traditional call-graphing alternatives like gprof might be considered, when you are working from source code and can switch temporarily to a compiler which supports it. I don't know how you would get value from call-graph when you don't have the source code.

I completely agree with Tim and would like to add the following:

Sampling is good for identifying which part of the code take most of the time (which is often different from which codeyou think takes most of the time). Furthermore, only event-based sampling can identify for you architectural events like cache misses, mispredicted branches, or cache line splits.

On the other hand, only call-graph can help you understand who called a function and how often. For algorithmic changes, you will therefore get a better insight with call-graph. The overhead is generally large, but you might be able to reduce the overhead, if you restrict the instrumention to the parts of the code that you are interested in. The VTune documentation describes this process.

For sake of completeness, I would like to mention a third option: a "statistical call-graph". This possibility is implemented in the Intel Performance Tuning Utility. It can be downloaded from http://whatif.intel.com/. The overhead is much smaller than for a traditional call-graph. However, the interpretation of the results is also harder.

Kind regards
Thomas
0 Kudos
zgzg2020
Beginner
383 Views
Thank you everyone for the great replies!!!
0 Kudos
Reply