- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Asa simple answer - not supported yet!
VTune Amplifier XE Beta supports (detects) APIs from traditional threading APIs, Intel TBB, OpenMP* and Intel Cilk - Boost is not included!
However some of the boost thread apis map back to standard posix thread apis. VTune Amplifier XE should capture thread creation and concurrency correctly.
I ever used Boost v1.37 on Linux* to build a small program, which createdtwo new threadsto do writing into buffer and reading from buffer.
#include
#include
#include
#includeconst int BUF_SIZE = 100;
const int ITERS = 10000;boost::mutex io_mutex;
class buffer
{
public:
typedef boost::mutex::scoped_lock scoped_lock;buffer() : p(0), c(0), full(0) { }
void put(int m)
{
scoped_lock lock(mutex);
if (full == BUF_SIZE)
{
{boost::mutex::scoped_lock lock(io_mutex);
std::cout << "Buffer is full. Waiting..." << std::endl;
}
while (full == BUF_SIZE)
cond.wait(lock);
}
buf= m;
p = (p+1) % BUF_SIZE;
++full;
cond.notify_one();
}int get()
{
scoped_lock lk(mutex);
if (full == 0)
{
{
boost::mutex::scoped_lock lock(io_mutex);
std::cout << "Buffer is empty. Waiting..." << std::endl;
}
while (full == 0)
cond.wait(lk);}
int i = buf;
c = (c+1) % BUF_SIZE;
--full;
cond.notify_one();
return i;
}private:
boost::mutex mutex;
boost::condition cond;
unsigned int p, c, full;
int buf[BUF_SIZE];
};buffer buf;
void writer()
{
for (int n = 0; n < ITERS; ++n)
{
{
boost::mutex::scoped_lock lock(io_mutex);std::cout << "sending: " << n << std::endl;
}
buf.put(n);
}
}void reader()
{
for (int x = 0; x < ITERS; ++x)
{
int n = buf.get();
{
boost::mutex::scoped_lock lock(io_mutex);
std::cout << "received: " << n << std::endl;
}
}
}int main(int argc, char* argv[])
{
boost::thread thrd1(&reader);
boost::thread thrd2(&writer);
thrd1.join();
thrd2.join();
return 0;
}
1) Hotspots - sometime result didn't show helpful info(Function name will be displayed as "[Unkown]") - if you run program shortly. That is why I put "ITERS" value to"10000"
2) Concurrency - result showthree threads in timeline report and function name can be displayed. Also all thread's activities can be captured, including thread creation, thread termination, thread transitions, Concurrency, CPU usage, etc.
3) Locks and Waits - result should show all sync-objects. We don't expect to get all the locks and waits done correctly, butsomemutexof BOOST still can bedetected!
Regards, Peter

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page