hwlm_dump: take base filename, like NFA dump API

This commit is contained in:
Justin Viiret 2017-06-26 14:39:46 +10:00 committed by Matthew Barr
parent cbcc46444b
commit bf3ced92f4
3 changed files with 20 additions and 22 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Intel Corporation * Copyright (c) 2015-2017, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -38,16 +38,19 @@
#include "ue2common.h" #include "ue2common.h"
#include "fdr/fdr_dump.h" #include "fdr/fdr_dump.h"
#include "nfa/accel_dump.h" #include "nfa/accel_dump.h"
#include "util/dump_util.h"
#include <cstdio>
#ifndef DUMP_SUPPORT #ifndef DUMP_SUPPORT
#error No dump support! #error No dump support!
#endif #endif
using namespace std;
namespace ue2 { namespace ue2 {
void hwlmPrintStats(const HWLM *h, FILE *f) { void hwlmGenerateDumpFiles(const HWLM *h, const string &base) {
StdioFile f(base + ".txt", "w");
switch (h->type) { switch (h->type) {
case HWLM_ENGINE_NOOD: case HWLM_ENGINE_NOOD:
noodPrintStats((const noodTable *)HWLM_C_DATA(h), f); noodPrintStats((const noodTable *)HWLM_C_DATA(h), f);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Intel Corporation * Copyright (c) 2015-2017, Intel Corporation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@ -35,16 +35,16 @@
#ifdef DUMP_SUPPORT #ifdef DUMP_SUPPORT
#include <cstdio> #include <string>
struct HWLM; struct HWLM;
namespace ue2 { namespace ue2 {
/** \brief Dump some information about the give HWLM structure. */ /** \brief Dump some information about the give HWLM structure. */
void hwlmPrintStats(const HWLM *h, FILE *f); void hwlmGenerateDumpFiles(const HWLM *h, const std::string &base);
} // namespace ue2 } // namespace ue2
#endif #endif // DUMP_SUPPORT
#endif #endif // HWLM_DUMP_H

View File

@ -2196,26 +2196,21 @@ void roseDumpPrograms(const vector<LitFragment> &fragments, const RoseEngine *t,
static static
void roseDumpLiteralMatchers(const RoseEngine *t, const string &base) { void roseDumpLiteralMatchers(const RoseEngine *t, const string &base) {
if (const HWLM *ftable = getFloatingMatcher(t)) { if (const HWLM *hwlm = getFloatingMatcher(t)) {
StdioFile f(base + "/lit_table_floating.txt", "w"); hwlmGenerateDumpFiles(hwlm, base + "/lit_table_floating");
hwlmPrintStats(ftable, f);
} }
if (const HWLM *drtable = getDelayRebuildMatcher(t)) { if (const HWLM *hwlm = getDelayRebuildMatcher(t)) {
StdioFile f(base + "/lit_table_delay_rebuild.txt", "w"); hwlmGenerateDumpFiles(hwlm, base + "/lit_table_delay_rebuild");
hwlmPrintStats(drtable, f);
} }
if (const HWLM *etable = getEodMatcher(t)) { if (const HWLM *hwlm = getEodMatcher(t)) {
StdioFile f(base + "/lit_table_eod.txt", "w"); hwlmGenerateDumpFiles(hwlm, base + "/lit_table_eod");
hwlmPrintStats(etable, f);
} }
if (const HWLM *sbtable = getSmallBlockMatcher(t)) { if (const HWLM *hwlm = getSmallBlockMatcher(t)) {
StdioFile f(base + "/lit_table_small_block.txt", "w"); hwlmGenerateDumpFiles(hwlm, base + "/lit_table_small_block");
hwlmPrintStats(sbtable, f);
} }
} }
void dumpRose(const RoseBuildImpl &build, const vector<LitFragment> &fragments, void dumpRose(const RoseBuildImpl &build, const vector<LitFragment> &fragments,