/*
Copyright 2005-2014 Intel Corporation. All Rights Reserved.
This file is part of Threading Building Blocks. Threading Building Blocks is free software;
you can redistribute it and/or modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation. Threading Building Blocks is
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. You should have received a copy of
the GNU General Public License along with Threading Building Blocks; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
As a special exception, you may use this file as part of a free software library without
restriction. Specifically, if other files instantiate templates or use macros or inline
functions from this file, or you compile this file and link it with other files to produce
an executable, this file does not by itself cause the resulting executable to be covered
by the GNU General Public License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU General Public License.
*/
/*
The original source for this example is
Copyright (c) 1994-2008 John E. Stone
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
package com.intel.tbb.example.tachyon;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Timer;
import java.util.TimerTask;
import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.content.Context;
import android.content.res.AssetManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
public class tachyon extends Activity {
private tachyonView myView;
private int W;
private int H;
private String fileOnSDcard;
private float currentYMenuPosition=(float) 1e5;
private float previousYMenuPosition=0;
public int number_of_threads=0;
public static TextView txtThreadNumber;
public static TextView txtElapsedTime;
private static native void setPaused(boolean paused);
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
fileOnSDcard = Environment.getExternalStorageDirectory()
.getPath() + "/tachyon/data.dat";
Log.i("tachyon", "Data file name is " + fileOnSDcard);
File dataFile = new File(fileOnSDcard);
if (dataFile.exists()) {
dataFile.delete();
}
if (!dataFile.exists()) {
AssetManager assetManager = getAssets();
InputStream inputFile = assetManager.open("data.dat");
dataFile.getParentFile().mkdirs();
dataFile.createNewFile();
OutputStream outputFile = new FileOutputStream(fileOnSDcard);
byte[] buffer = new byte[10000];
int bytesRead;
while ((bytesRead = inputFile.read(buffer)) != -1)
outputFile.write(buffer, 0, bytesRead);
inputFile.close();
inputFile = null;
outputFile.flush();
outputFile.close();
outputFile = null;
}
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
ActionBar actionBar = getActionBar();
actionBar.hide();
H = displayMetrics.heightPixels;
W = displayMetrics.widthPixels;
Log.i("tachyon", "displayMetrics.heightPixels: " + H);
Log.i("tachyon", "displayMetrics.widthPixels: " + W);
//uncomment to override scene size
int sceneWidth = 400;
float ratio = W>H?(float)(W)/H:(float)(H)/W;
W = sceneWidth;
H = (int) (W/ratio);
Log.i("tachyon", "Scene size is " + W + "*" + H );
} catch (Exception e) {
Log.e("tachyon", "Exception in file copy: " + e.getMessage());
}
myView = new tachyonView(this, W, H, fileOnSDcard);
setContentView(myView);
LinearLayout llThreadNumber = new LinearLayout(this);
txtThreadNumber = new TextView(this);
txtThreadNumber.setText("");
txtThreadNumber.setTextColor(0xFF00FF00);
txtThreadNumber.setScaleX(1);
txtThreadNumber.setScaleY(1);
txtThreadNumber.setPadding(10, 10, 10, 10);
llThreadNumber.setGravity(Gravity.TOP | Gravity.CENTER);
llThreadNumber.addView(txtThreadNumber);
this.addContentView(llThreadNumber,
new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
LinearLayout llElapsedTime = new LinearLayout(this);
txtElapsedTime = new TextView(this);
txtElapsedTime.setText("");
txtElapsedTime.setTextColor(0xFFFF0000);
txtElapsedTime.setScaleX(2);
txtElapsedTime.setScaleY(2);
txtElapsedTime.setPadding(10, 10, 40, 10);
llElapsedTime.setGravity(Gravity.TOP | Gravity.RIGHT);
llElapsedTime.addView(txtElapsedTime);
this.addContentView(llElapsedTime,
new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_screen_menu, menu);
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event)
{
currentYMenuPosition = event.getY();
if(event.getAction()==MotionEvent.ACTION_UP ){
ActionBar actionBar = getActionBar();
if (previousYMenuPosition < currentYMenuPosition){
actionBar.show();
}else{
actionBar.hide();
}
previousYMenuPosition = cu
没有合适的资源?快使用搜索试试~ 我知道了~
Intel TBB Library
共1406个文件
html:441个
h:169个
lib:148个
5星 · 超过95%的资源 需积分: 34 248 下载量 140 浏览量
2015-01-01
20:20:43
上传
评论
收藏 47.19MB ZIP 举报
温馨提示
TBB,Thread Building Blocks,线程构建模块,是Intel公司开发的并行编程开发的工具。 OSCON 上,Intel 宣布,Threading Building Blocks,Intel 众多软件开发工具中的一个,open source了。协议是 GPLv2。 TBB 获得过 17 届 Jolt Productivity Awards,是一套C++模板库,和直接利用 OSAPI写程序的 raw thread 比,在并行编程方面提供了适当的抽象,当然还包括更多其他内容,比如 task 概念,常用算法的成熟实现,自动负载均衡特性还有不绑定 CPU 数量的灵活的可扩展性等等。STL之父,Alexander Stepanov对此评价不错,他说“Threading Building Blocks… could become a basis for the concurrency dimension of the C++ standard library”。其他 TBB 的早期用户,包括Autodesk,Sun,Red Hat, Turbo Linux 等亦然。现在 O’Reilly 已经出版了一本 Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism。 TBB 可以在Windows,Linux和 OSX 上运行,支持 Intel, Microsoft 和GNU工具,这就覆盖了绝大多数需求范围。
资源推荐
资源详情
资源评论
收起资源包目录
Intel TBB Library (1406个子文件)
Package.appxmanifest 1KB
tbbvars.bat 4KB
copy_libraries.bat 3KB
copy_libraries_and_assets.bat 3KB
dxcheck.bat 2KB
CHANGES 73KB
.classpath 356B
condition_variable 15KB
COPYING 18KB
polyover.cpp 25KB
test_all.cpp 23KB
polymain.cpp 23KB
convex_hull_bench.cpp 20KB
Fibonacci.cpp 20KB
parse.cpp 20KB
som_graph.cpp 18KB
grid.cpp 18KB
DirectXBase.cpp 15KB
xvideo.cpp 15KB
binpack.cpp 15KB
shortpath.cpp 13KB
Update_state.cpp 13KB
dining_philosophers.cpp 12KB
api.cpp 12KB
sudoku.cpp 12KB
primes.cpp 11KB
convex_hull_sample.cpp 11KB
count_strings.cpp 10KB
main.cpp 10KB
trace.tbb.cpp 10KB
objbound.cpp 10KB
square.cpp 10KB
jni-engine.cpp 10KB
extvol.cpp 9KB
shade.cpp 9KB
texture.cpp 9KB
vol.cpp 8KB
fractal.cpp 8KB
apigeom.cpp 8KB
universe.cpp 8KB
som.cpp 8KB
cylinder.cpp 8KB
tgafile.cpp 8KB
apitrigeom.cpp 8KB
trace.tbb1d.cpp 7KB
triangle.cpp 7KB
Evolution.cpp 7KB
d2dvideo.cpp 7KB
Game_of_life.cpp 6KB
main.cpp 6KB
trace.serial.cpp 6KB
gdivideo.cpp 6KB
trace.simple.cpp 6KB
bndbox.cpp 6KB
jpeg.cpp 6KB
pover_video.cpp 6KB
sub_string_finder_extended.cpp 6KB
quadric.cpp 6KB
imap.cpp 6KB
intersect.cpp 5KB
box.cpp 5KB
main.cpp 5KB
trace_rest.cpp 5KB
main.cpp 5KB
pthread.cpp 5KB
imageio.cpp 5KB
seismic_video.cpp 5KB
tbbTachyonRenderer.cpp 5KB
util.cpp 5KB
tachyon_video.cpp 5KB
camera.cpp 5KB
DirectXPage.xaml.cpp 5KB
macvideo.cpp 5KB
ppm.cpp 5KB
ring.cpp 5KB
sphere.cpp 4KB
vector.cpp 4KB
light.cpp 4KB
main.cpp 4KB
main.cpp 4KB
ui.cpp 4KB
plane.cpp 4KB
convideo.cpp 4KB
render.cpp 4KB
coordsys.cpp 4KB
Graph.cpp 4KB
global.cpp 3KB
sub_string_finder_pretty.cpp 3KB
OptimizedParallelSumTree.cpp 3KB
sub_string_finder.cpp 3KB
SimpleParallelSumTree.cpp 3KB
AssemblyInfo.cpp 3KB
parallel_preorder.cpp 3KB
gen_input.cpp 2KB
App.xaml.cpp 2KB
SerialSumTree.cpp 2KB
.cproject 11KB
doxygen.css 20KB
tabs.css 1KB
balls3.dat 508KB
共 1406 条
- 1
- 2
- 3
- 4
- 5
- 6
- 15
github_24888943
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页