]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - jacinto-ai/caffe-jacinto.git/blob - src/programs/test_read_imagenet.cpp
misc update
[jacinto-ai/caffe-jacinto.git] / src / programs / test_read_imagenet.cpp
1 // Copyright 2013 Yangqing Jia
3 #include <glog/logging.h>
4 #include <leveldb/db.h>
5 #include <leveldb/write_batch.h>
7 #include <string>
9 int main(int argc, char** argv) {
10   ::google::InitGoogleLogging(argv[0]);
11   leveldb::DB* db;
12   leveldb::Options options;
13   options.create_if_missing = false;
15   LOG(INFO) << "Opening leveldb " << argv[1];
16   leveldb::Status status = leveldb::DB::Open(
17       options, argv[1], &db);
18   CHECK(status.ok()) << "Failed to open leveldb " << argv[1];
20   leveldb::ReadOptions read_options;
21   read_options.fill_cache = false;
22   int count = 0;
23   leveldb::Iterator* it = db->NewIterator(read_options);
24   for (it->SeekToFirst(); it->Valid(); it->Next()) {
25     // just a dummy operation
26     volatile std::string value = it->value().ToString();
27     // LOG(ERROR) << it->key().ToString();
28     if (++count % 10000 == 0) {
29       LOG(ERROR) << "Processed " << count << " files.";
30     }
31   }
33   delete db;
34   return 0;
35 }