]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
hwlm_dump: take base filename, like NFA dump API
authorJustin Viiret <justin.viiret@intel.com>
Mon, 26 Jun 2017 04:39:46 +0000 (14:39 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Mon, 21 Aug 2017 01:10:11 +0000 (11:10 +1000)
src/hwlm/hwlm_dump.cpp
src/hwlm/hwlm_dump.h
src/rose/rose_build_dump.cpp

index 58411ab28fb8b6216909f6622a0e97f7f47db30b..59353eeebc6875a6971252bf23f6427e686e902f 100644 (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
  * modification, are permitted provided that the following conditions are met:
 #include "ue2common.h"
 #include "fdr/fdr_dump.h"
 #include "nfa/accel_dump.h"
-
-#include <cstdio>
+#include "util/dump_util.h"
 
 #ifndef DUMP_SUPPORT
 #error No dump support!
 #endif
 
+using namespace std;
+
 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) {
     case HWLM_ENGINE_NOOD:
         noodPrintStats((const noodTable *)HWLM_C_DATA(h), f);
index e7e383539cf4a618ae4d0c6ddbe4447c75106215..12f61c86b128ecf7eddbc20f2d15581a5767149d 100644 (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
  * modification, are permitted provided that the following conditions are met:
 
 #ifdef DUMP_SUPPORT
 
-#include <cstdio>
+#include <string>
 
 struct HWLM;
 
 namespace ue2 {
 
 /** \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
 
-#endif
-#endif
+#endif // DUMP_SUPPORT
+#endif // HWLM_DUMP_H
index 81acec12c1eb5c0be4e972c5faf2b51113db884a..5e9f95f268af8d247b0eecdf5a45a0bec9a873db 100644 (file)
@@ -2196,26 +2196,21 @@ void roseDumpPrograms(const vector<LitFragment> &fragments, const RoseEngine *t,
 
 static
 void roseDumpLiteralMatchers(const RoseEngine *t, const string &base) {
-    if (const HWLM *ftable = getFloatingMatcher(t)) {
-        StdioFile f(base + "/lit_table_floating.txt", "w");
-        hwlmPrintStats(ftable, f);
+    if (const HWLM *hwlm = getFloatingMatcher(t)) {
+        hwlmGenerateDumpFiles(hwlm, base + "/lit_table_floating");
     }
 
-    if (const HWLM *drtable = getDelayRebuildMatcher(t)) {
-        StdioFile f(base + "/lit_table_delay_rebuild.txt", "w");
-        hwlmPrintStats(drtable, f);
+    if (const HWLM *hwlm = getDelayRebuildMatcher(t)) {
+        hwlmGenerateDumpFiles(hwlm, base + "/lit_table_delay_rebuild");
     }
 
-    if (const HWLM *etable = getEodMatcher(t)) {
-        StdioFile f(base + "/lit_table_eod.txt", "w");
-        hwlmPrintStats(etable, f);
+    if (const HWLM *hwlm = getEodMatcher(t)) {
+        hwlmGenerateDumpFiles(hwlm, base + "/lit_table_eod");
     }
 
-    if (const HWLM *sbtable = getSmallBlockMatcher(t)) {
-        StdioFile f(base + "/lit_table_small_block.txt", "w");
-        hwlmPrintStats(sbtable, f);
+    if (const HWLM *hwlm = getSmallBlockMatcher(t)) {
+        hwlmGenerateDumpFiles(hwlm, base + "/lit_table_small_block");
     }
-
 }
 
 void dumpRose(const RoseBuildImpl &build, const vector<LitFragment> &fragments,