uint32_t UtilTrinity::success_ = 0;
uint32_t UtilTrinity::total_ = 0;
uint32_t UtilTrinity::done_ = 0;
+bool UtilTrinity::dump_ = false;
/** @brief constructor of UtilTrinity */
UtilTrinity::UtilTrinity (dev_type type, bool need_model, bool verify)
mute_ = false;
sync_ = false;
+ dump_ = false;
}
/** @brief destructor of UtilTrinity */
std::cerr << " -n <arg> \t Set output notimode [intr|polling]\n";
std::cerr << " -m \t\t Mute stdout/stderr messages\n";
std::cerr << " -s \t\t Enable run sync mode\n";
+ std::cerr << " -o \t\t Enable output dump mode\n";
std::cerr << " -h \t\t Show help messages\n";
}
optind = 0;
opterr = 0;
- while ((c = getopt (argc, argv, "d:n:msh")) != -1) {
+ while ((c = getopt (argc, argv, "d:n:msho")) != -1) {
switch (c) {
case 'd':
setNodePath (optarg);
case 's':
setSync ();
break;
+ case 'o':
+ setDump ();
+ break;
case '?':
if (optopt == 'd' || optopt == 'n')
std::cerr << "Option 'd' or 'n' requires an extra argument";
for (uint32_t idx = 0; idx < output->num_buffers; idx++) {
if (model != nullptr) {
+ const char *path = model->getOutputPath (idx);
char *buf = static_cast<char*>(output->bufs[idx].addr);
size_t size = output->bufs[idx].size;
- if (compare_data (model->getOutputPath (idx), buf, size) != 0)
+ if (compare_data (path, buf, size) != 0)
success = false;
+
+ if (dump_) {
+ std::string dump_path (path);
+ dump_path += ".dump";
+
+ FILE * dump_fp = fopen (dump_path.c_str (), "w");
+ if (dump_fp != NULL) {
+ fwrite (buf, size, 1, dump_fp);
+ fclose (dump_fp);
+ }
+ }
}
free (output->bufs[idx].addr);
npudev_h getDeviceHandle () { return dev_; }
+ static void setDump () { dump_ = true; }
void setSync () { sync_ = true; }
void setMute ();
void setNotiMode (const std::string mode);
static uint32_t success_;
static uint32_t done_;
static uint32_t total_;
+
+ static bool dump_;
};
class UtilTRIV2 : public UtilTrinity {