Quantcast
Channel: Intel® VTune™ Profiler (Intel® VTune™ Amplifier)
Viewing all articles
Browse latest Browse all 1347

Analyse python file from embedded python

$
0
0

Hi, I would like have a python analysis for Python files executed from the C python API, like in this sample code adapted from https://docs.python.org/3/extending/embedding.html :

#define PY_SSIZE_T_CLEAN
#include <Python.h>

int
main(int argc, char *argv[])
{
	printf("before\n");
	wchar_t *program = Py_DecodeLocale(argv[0], NULL);
	if (program == NULL) {
		fprintf(stderr, "Fatal error: cannot decode argv[0]\n");
		exit(1);
	}
	Py_SetProgramName(program); 
	Py_Initialize();
	auto* f = fopen("f.py", "rb");
	auto r = PyRun_SimpleFile(f, "f.py");
	if (Py_FinalizeEx() < 0) {
		exit(120);
	}
	PyMem_RawFree(program);
	return 0;
}

When I use Hostspots analysis with user mode sampling and managed mode set to any of (auto, native, mixed), I only get the C/C++ functions. 

python37_d.dll ! PyEval_EvalFrameDefault - ceval.c
python37_d.dll ! PyEval_EvalCodeWithName + 0xaf3 - ceval.c:3930
python37_d.dll ! PyEval_EvalCodeEx + 0x95 - ceval.c:3959
python37_d.dll ! PyEval_EvalCode + 0x2d - ceval.c:524
python37_d.dll ! run_mod + 0x69 - pythonrun.c:1035
python37_d.dll ! PyRun_FileExFlags + 0x111 - pythonrun.c:988
python37_d.dll ! PyRun_SimpleFileExFlags + 0x4df - pythonrun.c:429
embed1.exe ! [embed1.exe] + 0x11a2f - [unknown source file]

It is possible to have the python file/stack analysis, and how ? Thank you

I use vtune 2020-60519 with Visual Studio 2017 on Windows.


Viewing all articles
Browse latest Browse all 1347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>