Community
cancel
Showing results for 
Search instead for 
Did you mean: 
rlturner
Beginner
139 Views

VTune Script using COM interface

I've been tasked with writing an automated profile utility for our project. It seems that using the script interface is the way to go, as the command line utility limits us to "sample" activities only. (Using a script allows us to re-run the call graph activity, which might have changed for the application.)
Problem I have is that though I've a fair amount of experience at optimization, I'm pretty much an idiot w/scripts (VBScript, PerlScript, whatever-no experience) and I've got a two-day deadline, so it seems writing a simple C++ console app to controlVTune viaCOM is appropriate.
Documentation on how to do this is pretty sparse, however. There's a sample w/VBScript in the documentation. Is there a similar example available for controlling from C++?
0 Kudos
5 Replies
rlturner
Beginner
139 Views

ie,I don't have the header declaring the com interface, or at least I can't find it. I don't know the type of the VTuneBatch object.In other words I can do..
CoInitialize(0);

if( S_OK != CLSIDFromProgID(L"VTuneBatch.VTune", &clsid )) {return false;}

but I can't do...

if( S_OK != CoCreateInstance(clsid, 0, CLSCTX_ALL, what_goes_here?, or_here?){return false;}

David_A_Intel1
Employee
139 Views

Basically, you don't want to go there. Trying to write a script for the COM interfaces with C++ is going to take way too much effort, IMHO. Just copy the VBScript example and start tweaking it.
BTW, if you are using version 7.1, while call graph is not "officially" supported from the command line, it is there! Just type: vtl query -lc (for list collectors) and you will see "call graph". It means you have to use double-quotes around "call graph" on the command line, but it will work.
rlturner
Beginner
139 Views

re: 7.1 vtl supporting call graphs- oh. Good to know. :) I assume there'd be some issues merging w/a sample activity, though? If not, I'll use it.
re: using VB scripts vs. C - w/a 2 day (now 1) deadline it seemed a good idea at the time. In retrospect, well...
btw, it is flat out impossible to use via a COM interface, right? Because there's no COM header on the disk, right?
David_A_Intel1
Employee
139 Views

You could probably generate the header files by importing the DLLs, but you would have to know which DLLs, or import them all! :-(
And, they aren't all designed to be scripted, anyway. Basically, what is shown in the example is all that is really available for use.
In the past, I put together a VB6 app that used one of the common interfaces and found that it had not been designed to be used via VB (unsupported parameter type). :-( So, you kind of have to stick with what is documented.
With VB, at least, you can view the objects via the object browser or the tooltips that are displayed in the editor for objects. This is how I searched for the support I needed. Again, this isn't really encouraged, since you may find a method or property that looks like what you want but either doesn't work the way you expect or doesn't use a supported parameter type.
rlturner
Beginner
139 Views

Okay. It's pretty easy to use VBScript, it's just that the goofy thing is just close enough to a programming language syntax to throw me off. No realproblem. :)
Thanks for the feedback,
Randall
Reply