ここでは、インテル® oneAPI スレッディング・ビルディング・ブロック (oneTBB) のフローグラフ・インターフェイスを使用するアプリケーションからトレースを収集する方法を説明します。
アプリケーションからトレースを収集するには、以下が必要です。
上記の前提条件のいずれかを満たさない場合、追加リソースのリンクを確認してください。
ここでは、次のサンプルコードを使用します。このコードは、example.cpp ファイルに格納されることを想定します。この例の代わりに独自のアプリケーション、またはサンプルを使用することもできます。
#include "tbb/flow_graph.h"
#include <iostream>
using namespace std;
using namespace tbb::flow;
int main() {
graph g;
continue_node< continue_msg> hello( g,
[]( const continue_msg &) {
cout << "Hello";
}
);
continue_node< continue_msg> world( g,
[]( const continue_msg &) {
cout << " World\n";
}
);
make_edge(hello, world);
hello.try_put(continue_msg());
g.wait_for_all();
return 0;
}