<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Analyse python file from embedded python in Analyzers</title>
    <link>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152051#M17445</link>
    <description>&lt;P&gt;Hi, I would like have a python analysis for Python files executed from the C python API, like in this sample code adapted from&amp;nbsp;https://docs.python.org/3/extending/embedding.html :&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;#define PY_SSIZE_T_CLEAN
#include &amp;lt;Python.h&amp;gt;

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() &amp;lt; 0) {
		exit(120);
	}
	PyMem_RawFree(program);
	return 0;
}&lt;/PRE&gt;

&lt;P&gt;When I use Hostspots analysis with user mode sampling and managed mode set to any of (auto, native,&amp;nbsp;mixed), I only get the C/C++ functions.&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:; class-name:dark;"&gt;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]
&lt;/PRE&gt;

&lt;P&gt;It is possible to have the python file/stack analysis, and how ? Thank you&lt;/P&gt;
&lt;P&gt;I use vtune 2020-60519 with Visual Studio 2017 on Windows.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Mar 2020 12:57:01 GMT</pubDate>
    <dc:creator>Philippe_C_</dc:creator>
    <dc:date>2020-03-31T12:57:01Z</dc:date>
    <item>
      <title>Analyse python file from embedded python</title>
      <link>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152051#M17445</link>
      <description>&lt;P&gt;Hi, I would like have a python analysis for Python files executed from the C python API, like in this sample code adapted from&amp;nbsp;https://docs.python.org/3/extending/embedding.html :&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;#define PY_SSIZE_T_CLEAN
#include &amp;lt;Python.h&amp;gt;

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() &amp;lt; 0) {
		exit(120);
	}
	PyMem_RawFree(program);
	return 0;
}&lt;/PRE&gt;

&lt;P&gt;When I use Hostspots analysis with user mode sampling and managed mode set to any of (auto, native,&amp;nbsp;mixed), I only get the C/C++ functions.&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:; class-name:dark;"&gt;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]
&lt;/PRE&gt;

&lt;P&gt;It is possible to have the python file/stack analysis, and how ? Thank you&lt;/P&gt;
&lt;P&gt;I use vtune 2020-60519 with Visual Studio 2017 on Windows.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 12:57:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152051#M17445</guid>
      <dc:creator>Philippe_C_</dc:creator>
      <dc:date>2020-03-31T12:57:01Z</dc:date>
    </item>
    <item>
      <title>Hi Philippe</title>
      <link>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152052#M17446</link>
      <description>&lt;P&gt;Hi Philippe&lt;/P&gt;&lt;P&gt;Vtune usually tend to point to cpp code abstracted beneath the python code. So it is expected behavior to get ony the &amp;nbsp;the C/C++ functions. We will check with experts on the possibility of a python file/stack analysis and get back to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Arun Jose&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 05:15:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152052#M17446</guid>
      <dc:creator>ArunJ_Intel</dc:creator>
      <dc:date>2020-04-01T05:15:39Z</dc:date>
    </item>
    <item>
      <title>Hi Philippe.</title>
      <link>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152053#M17447</link>
      <description>&lt;P&gt;Hi Philippe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are some limitations with Python profiling in VTune. You can refer this&amp;nbsp;https://software.intel.com/en-us/vtune-help-python-code-analysis for more details. I saw you are using Python 3. The best support from VTune is currently available for Python 2.6.&amp;nbsp;Also, your application should have at least 2 Python functions in the stack otherwise VTune may show only native code profile data. If still you are having issues, please feel free to respond to the thread.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mayank&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 11:51:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152053#M17447</guid>
      <dc:creator>Mayank_T_Intel</dc:creator>
      <dc:date>2020-04-02T11:51:00Z</dc:date>
    </item>
    <item>
      <title>Hi Philippe,</title>
      <link>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152054#M17448</link>
      <description>&lt;P&gt;Hi Philippe,&lt;/P&gt;&lt;P&gt;Has your issue been resolved? Can we close the thread?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mayank&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 07:37:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152054#M17448</guid>
      <dc:creator>Mayank_T_Intel</dc:creator>
      <dc:date>2020-04-08T07:37:23Z</dc:date>
    </item>
    <item>
      <title>Hi Mayank,</title>
      <link>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152055#M17449</link>
      <description>&lt;P&gt;Hi Mayank,&lt;/P&gt;&lt;P&gt;You can close this thread, although my issue is not solved, as I must use Python 3. I will stay tuned for updated about Python 3 support. My final use case is to profile a&amp;nbsp;Blender plugin. I just checked and I can confirm that vTune&amp;nbsp;insists in showing only the C frames, although the Python stack is at least 6 python functions deep.&lt;/P&gt;&lt;P&gt;Philippe&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 15:29:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1152055#M17449</guid>
      <dc:creator>Philippe_C_</dc:creator>
      <dc:date>2020-04-08T15:29:46Z</dc:date>
    </item>
    <item>
      <title>Re:Analyse python file from embedded python</title>
      <link>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1281922#M20512</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 16px;"&gt;Hi Philippe,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 16px;"&gt;I am going ahead and closing this case.&lt;/SPAN&gt;&lt;SPAN style="font-size: 16px; font-family: intel-clear, tahoma, Helvetica, helvetica, Arial, sans-serif;"&gt; W&lt;/SPAN&gt;&lt;SPAN style="font-size: 16px;"&gt;e will no longer respond to this thread.&amp;nbsp;If you require additional assistance from Intel, please start a new thread.&amp;nbsp;Any further interaction in this thread will be considered community only.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 17 May 2021 11:45:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Analyse-python-file-from-embedded-python/m-p/1281922#M20512</guid>
      <dc:creator>DrAmarpal_K_Intel</dc:creator>
      <dc:date>2021-05-17T11:45:46Z</dc:date>
    </item>
  </channel>
</rss>

