// test reading speed from a InputSplit #include #include #include #include int main(int argc, char *argv[]) { if (argc < 4) { printf("Usage: partid npart\n"); return 0; } using namespace dmlc; InputSplit *split = InputSplit::Create(argv[1], atoi(argv[2]), atoi(argv[3]), "text"); std::vector data; InputSplit::Blob blb; double tstart = GetTime(); size_t bytes_read = 0; size_t bytes_expect = 10UL << 20UL; while (split->NextRecord(&blb)) { std::string dat = std::string((char*)blb.dptr, blb.size); data.push_back(dat); bytes_read += blb.size; double tdiff = GetTime() - tstart; if (bytes_read >= bytes_expect) { printf("%lu MB read, %g MB/sec\n", bytes_read >> 20UL, (bytes_read >> 20UL) / tdiff); bytes_expect += 10UL << 20UL; } } delete split; return 0; }