VTStartSampling: Assertion `g_lsepAdapter != ((void *)0)' failed.

VTStartSampling: Assertion `g_lsepAdapter != ((void *)0)' failed.


I am sampling a code (based on pthread) using Vtune. I would like to print in a file the
values of the events that correspond to each single iteration of a
loop. I used VTStartSampling(&params) and VTStopSampling(1) as
sepcified in the code written below but I got this error


: sampling.c:506: VTStartSampling:
Assertion `g_lsepAdapter != ((void *)0)' failed.


I get the same error when I compile the
code described below:

I compile it using :
/opt/intel/cc64/bin/icc -I/opt/intel/vtune/rdc/analyzer/include/ -L/opt/intel/vtune/rdc/analyzer/bin -lVtuneApi vtune_code.cpp


I run it using: vtl activity -c sampling
-app ./a.out run

I am using Vtune on a Linux x86_64
x86_64 x86_64 GNU/Linux.

Any suggestion!



#include "stdafx.h"
#include "VtuneApi.h"

int _tmain(int argc, _TCHAR* argv[])
U32 u32Return;

VTUNE_EVENT events[] = {
{ 10000, 0, 0, 0,
"CPU_CLK_UNHALTED.CORE" }, // Sample After Value, Reserved, Reserved,
Return Status, Event Name - my system is Intel Core 2 Duo
{ 10000, 0, 0, 0, "INST_RETIRED.ANY" }, //Use "vtlquery
-c sampling" to know all supported events inyour system, in command

U32 numEvents = sizeof(events) / sizeof(VTUNE_EVENT);
0, // sampling options
0, // reserved
0, // If 1, startsampling in pause mode
0, // maximum number of samples tobe collected.
1000, // number of samples per buffer
40,// the sampling interval in milliseconds
1, // "1" for event based sampling
numEvents,// number of events
events, // event list array
"results.tb5", // result file with or without full path
0, // reserved
0, // "1" - generate a count file "tb5Filename.txt"
"" // CPU mask

u32Return = VTStartSampling(&params); // start samplingsinceit is not in pause mode
if (u32Return) {
printf("Can't start sampling\\n");
for (int i=0; i<10000000L; i++); // do some work, data is captured

VTPauseSampling(); //pause data collection

for (int i=0; i<10000000L; i++); // do some work, data is NOT captured

VTResumeSampling(); // resume data collection

for (int i=0; i<10000000L; i++); // do some work, data is captured again

u32Return = VTStopSampling(1); // stop collecting data and write result into TB5 file, use VTuneAnalyzerto import it!

if (u32Return) {
printf("Can't stop sampling\\n");

return 0;

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


Please check -
1)Has vtune driver been loadedin system? Use "lsmod | grep vtune"
2)Can sampling collector work? Use "vtl query -lc"
3) If 1) and/or 2) is wrong, please check the reason
4) Use right events name in "VTUNE_EVENT events[]" - compare with outputof "vtl query -sampling"
5) Do NOT use vtl to launch your a.out - simply run a.out which can collect performance data, and.tb5 file should be generated.

Regards, Peter


I checked
all the points mentioned above. Everything looks Ok, however
when I execute ./a.out I still get exactly the same error.

VTStartSampling: Assertion `g_lsepAdapter != ((void *)0)' failed.

Thanks again.


Thanks for raising this issue!

Actually I can reproduce this problem, butexample code ever worked on Windows* system.

Iprovide a temp solution -

1. Please don'tuse (remove) VTStartSampling() in your code,it also includes sampling configuration work. That means, vtl or vtlec will do all sampling configuration& start.

2. Also remove VTStopSampling() in your code, vtl or vtlec will do this.

So there are only VTResumeSampling() / VTPauseSampling() in your code.

I have verified - it works!!!

Bye the way, please use icc with "-g -O0". So symbol info will be generated, and code is not optimized. You can use like "vtl view -hf -mn a.out" to find hot functions, or view result on GUI directly

Regards, Peter

Leave a Comment

Please sign in to add a comment. Not a member? Join today