Intel® Advisor User Guide

ID 766448
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Collecting Traces from Applications

This section explains how to collect traces from an application that uses the Intel® oneAPI Threading Building Blocks (oneTBB) flow graph interfaces.

Prerequisites

You need the following to collect traces from an application:

  • An application that uses the oneTBB library flow graph interface
  • The Flow Graph Collector library

Check the links in the Additional Resources section if you are missing any of these prerequisites.

Simple Sample Application

This section uses the sample code below as a running example. Assume this code is contained in a file example.cpp. You can also use your own application or sample instead of this simple example.

#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;
}