STXXL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
I/O Performance Counter

The STXXL library provides various I/O performance counters (stxxl::stats class) which can be used to get an extensive set of I/O statistics. They can be accessed as follows:

// generate stats instance
// start measurement here
stxxl::stats_data stats_begin(*Stats);
// some computation ...
// substract current stats from stats at the beginning of the measurement
std::cout << (stxxl::stats_data(*Stats) - stats_begin);

The Stats ostream holds various measured I/O data:

STXXL I/O statistics
 total number of reads                      : 2
 average block size (read)                  : 2097152 (2.000 MiB)
 number of bytes read from disks            : 4194304 (4.000 MiB)
 time spent in serving all read requests    : 0.062768 s @ 63.7268 MiB/s
 time spent in reading (parallel read time) : 0.062768 s @ 63.7268 MiB/s
 total number of writes                     : 2
 average block size (write)                 : 2097152 (2.000 MiB)
 number of bytes written to disks           : 4194304 (4.000 MiB)
 time spent in serving all write requests   : 0.0495751 s @ 80.6857 MiB/s
 time spent in writing (parallel write time): 0.0495751 s @ 80.6857 MiB/s
 time spent in I/O (parallel I/O time)      : 0.112343 s @ 71.2104 MiB/s
 I/O wait time                              : 0.104572 s
 I/O wait4read time                         : 0.054934 s
 I/O wait4write time                        : 0.049638 s
 Time since the last reset                  : 0.605008 s

We can access individual I/O data in contrast to the whole content of Stats ostream by:

std::cout << Stats->get_written_volume() << std::endl; // print number of bytes written to the disks

Hint: There's another statistical parameter which may be in developer's interest: the maximum number of bytes (the peak) allocated in external memory during program run. This parameter can be accessed by:

// lots of external work here...
std::cout << "max: " << bm->get_maximum_allocation() << std::endl; // max. number of bytes allocated until now

See stxxl::stats and stxxl::stats_data class reference for all provided individual functions.