Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

Commit 79642b0

Browse files
committed
hpcprof: generate a separate experiment.dtd file
This fix will move DTD specification in experiment.xml to a separate DTD file (named experiment.dtd) so that hpcviewer can parse XML file much faster.
1 parent c292ebf commit 79642b0

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/lib/analysis/Args.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ class Args {
190190

191191
#define Analysis_OUT_DB_EXPERIMENT "experiment.xml"
192192
#define Analysis_OUT_DB_CSV "experiment.csv"
193+
#define Analysis_OUT_DB_DTD "experiment.dtd"
193194

194195
#define Analysis_DB_DIR_pfx "hpctoolkit"
195196
#define Analysis_DB_DIR_nm "database"

src/lib/analysis/CallPath.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,18 @@ makeDatabase(Prof::CallPath::Profile& prof, const Analysis::Args& args)
12311231
Analysis::CallPath::write(prof, *os, args);
12321232
IOUtil::CloseStream(os);
12331233

1234+
// 5. Create 'experiment.dtd' file
1235+
string dtd_fnm = db_dir + "/" + Analysis_OUT_DB_DTD;
1236+
os = IOUtil::OpenOStream(dtd_fnm.c_str());
1237+
os_buf = os->rdbuf();
1238+
os_buf->pubsetbuf(outBuf, HPCIO_RWBufferSz);
1239+
1240+
static const char* experimentDTD =
1241+
#include <lib/xml/hpc-experiment.dtd.h>
1242+
*os << experimentDTD;
1243+
1244+
IOUtil::CloseStream(os);
1245+
12341246
delete[] outBuf;
12351247
}
12361248

@@ -1239,9 +1251,6 @@ static void
12391251
write(Prof::CallPath::Profile& prof, std::ostream& os,
12401252
const Analysis::Args& args)
12411253
{
1242-
static const char* experimentDTD =
1243-
#include <lib/xml/hpc-experiment.dtd.h>
1244-
12451254
using namespace Prof;
12461255

12471256
int oFlags = 0; // CCT::Tree::OFlg_LeafMetricsOnly;
@@ -1269,9 +1278,9 @@ write(Prof::CallPath::Profile& prof, std::ostream& os,
12691278
string name = (args.title.empty()) ? prof.name() : args.title;
12701279

12711280
os << "<?xml version=\"1.0\"?>\n";
1272-
os << "<!DOCTYPE HPCToolkitExperiment [\n" << experimentDTD << "]>\n";
12731281

12741282
os << "<HPCToolkitExperiment version=\"" DATABASE_VERSION "\">\n";
1283+
os << "<!--DTD file=\"" Analysis_OUT_DB_DTD "\"-->\n";
12751284
os << "<Header n" << MakeAttrStr(name) << ">\n";
12761285
os << " <Info/>\n";
12771286
os << "</Header>\n";

0 commit comments

Comments
 (0)