Tracing unmanaged code – VBA, C++ etc.

One of the great new features in SpeedTrace Pro 4.0.9 is the user trace option to provide tracing and profiling method for non .Net code.

Now SpeedTrace 4.0 provides a COM object in order to enable you to trace your non- dotNet – platforms such as VBA, JavaScript, unmanaged C++ etc. For your convenience you can even add data to identity some kind of context during the performance reading.

Example VBA: In order to use the COM object, you need to instantiate it by the help of the type library (TLB-file). In office applications (Excel, Word etc.), add the type library (TLB) to the project references (Tools – References).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Sub Macro1()
 
Dim tracer As Perfinity_SpeedTrace_UserTrace.Trace
Set tracer = New Perfinity_SpeedTrace_UserTrace.Trace
 
For i = 1 To 1000
 
tracer.StartTransaction "FillAndReplace"
tracer.StartTransactionEx "Fill", "0"
 
ActiveCell.FormulaR1C1 = "0"
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:E1"), Type:=xlFillDefault
Range("A1:E1").Select
Selection.AutoFill Destination:=Range("A1:E2"), Type:=xlFillDefault
Range("A1:E2").Select
Range("E1:E2").Select
Selection.AutoFill Destination:=Range("E1:E11"), Type:=xlFillDefault
Range("E1:E11").Select
Range("E11").Select
Selection.AutoFill Destination:=Range("E11:J11"), Type:=xlFillDefault
Range("E11:J11").Select
Range("J11").Select
Selection.AutoFill Destination:=Range("J11:J20"), Type:=xlFillDefault
Range("J11:J20").Select
Range("L15").Select
 
tracer.EndTransactionEx "Fill", "done"
 
 
tracer.StartTransactionEx "Replace", "0->1"
 
Selection.Replace What:="0", Replacement:="1", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
 
tracer.EndTransactionEx "Replace", "done"
 
tracer.EndTransaction "FillAndReplace"
 
Next
End Sub

Recorded trace:

SpeedTrace Pro traces Excel VBA Code

VBA Code Trace of Excel function

Calculated profile / Call Stacks, Call History:

VBA Code Profiler - SpeedTrace Pro

VBA Code Profile – Call Stacks

VBA Code Profiler - SpeedTrace Pro

VBA Code Profile – Call History

More about SpeedTrace >>

0
  Related Posts

Add a Comment