{"id":161527,"date":"2012-12-21T15:28:03","date_gmt":"2012-12-21T11:28:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=161527"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=161527","title":{"rendered":"<span class=\"post_title\">Android: \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Intel\u00ae Threading Building Blocks<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/intel\/blog\/158263\/\">\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows<\/a> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Intel\u00ae Threading Building Blocks(<a href=\"http:\/\/threadingbuildingblocks.org\/\">Intel\u00ae TBB<\/a>). \u0422\u0430\u043c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 TBB \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. Android \u043a\u0430\u043a \u0440\u0430\u0437 \u0441\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u00ab\u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u00bb, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u044b\u0448\u0435\u0434\u0448\u0435\u043c \u0440\u0435\u043b\u0438\u0437\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Intel\u00ae TBB tbb41_20121112oss, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/threadingbuildingblocks.org\">threadingbuildingblocks.org<\/a>, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f Android, \u0442.\u0435. \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 JNI \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Android SDK Tools Rev.21 \u0438 Android NDK Rev 8C. \u041d\u043e \u0442\u0443\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e, \u043a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430, \u0441\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u043b\u0438\u0437\u0435. \u00ab\u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434 NDK \u043d\u0430 Linux. \u041c\u044b \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043c \u044d\u0442\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439. \u042f \u043f\u043e\u0434\u043f\u0438\u043b\u0438\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e makefile \u0434\u043b\u044f Windows \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0442\u0430\u043c, \u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0430\u043c\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 Linux, \u0430 \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0430 Windows. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0430\u043b\u0438\u0446\u043e \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Intel TBB.<br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e\u0442 \u0440\u0435\u043b\u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445. \u041f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0441\u0442\u044c gnu make, \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0441 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f NDK \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <\/p>\n<pre><code class=\"bash\">gmake tbb tbbmalloc target=android <\/code><\/pre>\n<p>  \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0441\u0451, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 Eclipse. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438, \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b, \u043a\u0430\u043a \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0437\u043e\u0432\u0451\u043c \u0435\u0433\u043e app1:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/d51\/eff\/cad\/d51effcade6e65b0ff829fe40e5d6d2e.png\"\/><\/p>\n<p>  Activity \u0432\u044b\u0431\u0435\u0440\u0435\u043c FullscreenActivity. \u041d\u0430 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e com.example* \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u043e\u043c \u0433\u0443\u0433\u043b. \u041d\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043e\u0439\u0434\u0435\u0442.<\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0430\u0440\u0443 \u043a\u043d\u043e\u043f\u043e\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0440\u0435\u0439\u043c. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e XML \u0444\u0430\u0439\u043b \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0430 (app1\/res\/layout\/activity_fullscreen.xml) \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a<\/p>\n<pre><code class=\"xml\">&lt;FrameLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;     xmlns:tools=&quot;http:\/\/schemas.android.com\/tools&quot;     android:layout_width=&quot;match_parent&quot;     android:layout_height=&quot;match_parent&quot;     android:background=&quot;#0099cc&quot;     tools:context=&quot;.FullscreenActivity&quot; &gt;     &lt;TextView         android:id=&quot;@+id\/fullscreen_content&quot;         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;match_parent&quot;         android:gravity=&quot;center&quot;         android:keepScreenOn=&quot;true&quot;         android:text=&quot;@string\/dummy_content&quot;         android:textColor=&quot;#33b5e5&quot;         android:textSize=&quot;50sp&quot;         android:textStyle=&quot;bold&quot; \/&gt;     &lt;FrameLayout         android:layout_width=&quot;match_parent&quot;         android:layout_height=&quot;match_parent&quot;         android:fitsSystemWindows=&quot;true&quot; &gt;         &lt;LinearLayout             android:id=&quot;@+id\/fullscreen_content_controls&quot;             style=&quot;?buttonBarStyle&quot;             android:layout_width=&quot;match_parent&quot;             android:layout_height=&quot;74dp&quot;             android:layout_gravity=&quot;bottom|center_horizontal&quot;             android:background=&quot;@color\/black_overlay&quot;             android:orientation=&quot;horizontal&quot;             tools:ignore=&quot;UselessParent&quot; &gt;             &lt;Button                 android:id=&quot;@+id\/dummy_button1&quot;                 style=&quot;?buttonBarButtonStyle&quot;                 android:layout_width=&quot;0dp&quot;                 android:layout_height=&quot;wrap_content&quot;                 android:layout_weight=&quot;1&quot;                 android:text=&quot;@string\/dummy_button1&quot;                 android:onClick=&quot;onClickSR&quot; \/&gt;             &lt;Button                 android:id=&quot;@+id\/dummy_button2&quot;                 style=&quot;?buttonBarButtonStyle&quot;                 android:layout_width=&quot;0dp&quot;                 android:layout_height=&quot;wrap_content&quot;                 android:layout_weight=&quot;1&quot;                 android:text=&quot;@string\/dummy_button2&quot;                 android:onClick=&quot;onClickDR&quot; \/&gt;         &lt;\/LinearLayout&gt;     &lt;\/FrameLayout&gt; &lt;\/FrameLayout&gt; <\/code><\/pre>\n<p>  \u0410 \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 (app1\/res\/values\/strings.xml) \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;resources&gt;     &lt;string name=&quot;app_name&quot;&gt;Sample&lt;\/string&gt;     &lt;string name=&quot;dummy_content&quot;&gt;Reduce sample&lt;\/string&gt;     &lt;string name=&quot;dummy_button1&quot;&gt;Simple Reduce&lt;\/string&gt;     &lt;string name=&quot;dummy_button2&quot;&gt;Deterministic Reduce&lt;\/string&gt; &lt;\/resources&gt; <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043a\u043d\u043e\u043f\u043e\u043a  <\/p>\n<pre><code class=\"java\">\/\/ JNI functions private native float onClickDRCall(); private native float onClickSRCall();      \tpublic void onClickDR(View myView) { \t\tTextView tv=(TextView)(this.findViewById(R.id.fullscreen_content));  \t\tfloat res=onClickDRCall(); \t\ttv.setText(&quot;Result DR is \\n&quot; + res); \t}  \tpublic void onClickSR(View myView) { \t\tTextView tv=(TextView)(this.findViewById(R.id.fullscreen_content));  \t\tfloat res=onClickSRCall(); \t\ttv.setText(&quot;Result SR is \\n&quot; + res); \t}   <\/code><\/pre>\n<p>  \u0418 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 FullscreenActivity.java  <\/p>\n<pre><code class=\"java\">\t@Override \tprotected void onCreate(Bundle savedInstanceState) { \t\tsuper.onCreate(savedInstanceState);  \u2026 \t\tSystem.loadLibrary(&quot;tbb&quot;); \t\tSystem.loadLibrary(&quot;jni-engine&quot;);\t\t \t} <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u00abtbb\u00bb \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u0441\u0451 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0442\u043e \u043d\u0430 \u00abjni-engine\u00bb \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p>  \u00abjni-engine\u00bb \u2014 \u044d\u0442\u043e \u0421++ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0421-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0434\u043b\u044f JNI \u0432\u044b\u0437\u043e\u0432\u043e\u0432 onClickSRCall() \u0438 onClickSRCall().<\/p>\n<p>  \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u2018jni\u2019 \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0430\u043c 3 \u0444\u0430\u0439\u043b\u0430, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u00abjni-engine\u00bb. \u042d\u0442\u043e:<br \/>  Android.mk (\u0432 &lt;&gt; \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f)  <\/p>\n<pre><code class=\"cmake\">LOCAL_PATH := $(call my-dir) TBB_PATH := &lt;path_to_the_package&gt; \t include $(CLEAR_VARS)  LOCAL_MODULE    := jni-engine LOCAL_SRC_FILES := jni-engine.cpp  LOCAL_CFLAGS += -DTBB_USE_GCC_BUILTINS -std=c++11 -I$(TBB_PATH)\/include LOCAL_LDLIBS := -ltbb -L.\/ -L$(TBB_PATH)\/&lt;path_to_libtbb_so&gt;  include $(BUILD_SHARED_LIBRARY)  include $(CLEAR_VARS) LOCAL_MODULE    := libtbb LOCAL_SRC_FILES := libtbb.so include $(PREBUILT_SHARED_LIBRARY) <\/code><\/pre>\n<p>  Application.mk  <\/p>\n<pre><code class=\"cmake\">APP_ABI := x86 APP_GNUSTL_FORCE_CPP_FEATURES := exceptions rtti APP_STL := system <\/code><\/pre>\n<p>  jni-engine.cpp:  <\/p>\n<pre><code class=\"cpp\">#include &lt;jni.h&gt;  #include &quot;tbb\/parallel_reduce.h&quot; #include &quot;tbb\/blocked_range.h&quot;  float SR_Click() {     int N=10000000;     float fr = 1.0f\/(float)N;     float sum = tbb::parallel_reduce(         tbb::blocked_range&lt;int&gt;(0,N), 0.0f,         [=](const tbb::blocked_range&lt;int&gt;& r, float sum)-&gt;float {             for( int i=r.begin(); i!=r.end(); ++i )                 sum += fr;             return sum;     },         []( float x, float y )-&gt;float {             return x+y;     }     );     return sum;\t }  float DR_Click() {     int N=10000000;     float fr = 1.0f\/(float)N;     float sum = tbb::parallel_deterministic_reduce(         tbb::blocked_range&lt;int&gt;(0,N), 0.0f,         [=](const tbb::blocked_range&lt;int&gt;& r, float sum)-&gt;float {             for( int i=r.begin(); i!=r.end(); ++i )                 sum += fr;             return sum;     },         []( float x, float y )-&gt;float {             return x+y;     }     );\t     return sum;\t }  extern &quot;C&quot; JNIEXPORT jfloat JNICALL Java_com_example_app1_FullscreenActivity_onClickDRCall(JNIEnv *env, jobject obj) {     return DR_Click(); }  extern &quot;C&quot; JNIEXPORT jfloat JNICALL Java_com_example_app1_FullscreenActivity_onClickSRCall(JNIEnv *env, jobject obj) {     return SR_Click(); } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0435 \u0436\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u0447\u0442\u043e \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0431\u043b\u043e\u0433\u0435.<\/p>\n<p>  \u041f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e NDK \u043e\u043d \u0441\u0430\u043c \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 libjni-engine.so \u0438 libtbb.so. <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 eclipse \u0438 \u0441\u0442\u0440\u043e\u0438\u043c .apk \u0444\u0430\u0439\u043b. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430 AVD \u0438\u043b\u0438 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u0412\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430 AVD:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/ce2\/baa\/516\/ce2baa51643863c9d0dc87d0040e9c49.png\"\/><\/p>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0451! \u041d\u0430\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e! \u0410 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0431\u043b\u043e\u0433\u0430, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043d\u043e \u043d\u0430 Android. <\/p>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f, \u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435:<\/p>\n<p>  \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Intel\u00ae Threading Building Blocks (\u0412\u0435\u0440\u0441\u0438\u044f \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c):<br \/>  <a href=\"http:\/\/threadingbuildingblocks.org\">threadingbuildingblocks.org<\/a><br \/>  \u041a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f Intel\u00ae TBB (\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f):<br \/>  <a href=\"http:\/\/software.intel.com\/en-us\/intel-tbb\">software.intel.com\/en-us\/intel-tbb<\/a> <\/p>\n<p>  \u0410\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0435 \u0438 \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0435 \u0431\u043b\u043e\u0433\u0438 \u043e\u0431 Intel\u00ae TBB<br \/>  <a href=\"http:\/\/software.intel.com\/en-us\/tags\/17207\">software.intel.com\/en-us\/tags\/17207<\/a><br \/>  <a href=\"http:\/\/software.intel.com\/en-us\/tags\/17220\">software.intel.com\/en-us\/tags\/17220<\/a> <br \/>  \u041d\u0443 \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430\u0448 \u0444\u043e\u0440\u0443\u043c,<br \/>  <a href=\"http:\/\/software.intel.com\/en-us\/forums\/intel-threading-building-blocks\">software.intel.com\/en-us\/forums\/intel-threading-building-blocks<\/a>    \t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/intel\/blog\/161527\/\"> http:\/\/habrahabr.ru\/company\/intel\/blog\/161527\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/intel\/blog\/158263\/\">\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Windows<\/a> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Intel\u00ae Threading Building Blocks(<a href=\"http:\/\/threadingbuildingblocks.org\/\">Intel\u00ae TBB<\/a>). \u0422\u0430\u043c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 TBB \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. Android \u043a\u0430\u043a \u0440\u0430\u0437 \u0441\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u00ab\u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u00bb, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-161527","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=161527"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161527\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}