Add option to filter type
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
This commit is contained in:
parent
8141e3c83d
commit
c6ddc7e081
|
|
@ -80,8 +80,7 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
|
|||
});
|
||||
DECL_OPTION("-write", Set, &m_writeFile);
|
||||
DECL_OPTION("-write-info", Set, &m_writeInfoFile);
|
||||
DECL_OPTION("-toggle-only", OnOff, &m_toggleOnly);
|
||||
DECL_OPTION("-skip-toggle", OnOff, &m_skipToggle);
|
||||
DECL_OPTION("-filter-type", Set, &m_filterType);
|
||||
parser.finalize();
|
||||
|
||||
// Parse parameters
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include "config_build.h"
|
||||
#include "verilatedos.h"
|
||||
|
||||
#include "VlcPoint.h"
|
||||
#include "config_rev.h"
|
||||
|
||||
#include <map>
|
||||
|
|
@ -43,8 +44,7 @@ class VlcOptions final {
|
|||
bool m_unlink = false; // main switch: --unlink
|
||||
string m_writeFile; // main switch: --write
|
||||
string m_writeInfoFile; // main switch: --write-info
|
||||
bool m_toggleOnly = false; // main switch: --m_toggle_only
|
||||
bool m_skipToggle = false; // main switch: --m_skip_toggle
|
||||
string m_filterType; // main switch: --filter-type
|
||||
// clang-format on
|
||||
|
||||
private:
|
||||
|
|
@ -71,8 +71,9 @@ public:
|
|||
bool unlink() const { return m_unlink; }
|
||||
string writeFile() const { return m_writeFile; }
|
||||
string writeInfoFile() const { return m_writeInfoFile; }
|
||||
bool toggleOnly() const { return m_toggleOnly; }
|
||||
bool skipToggle() const { return m_skipToggle; }
|
||||
bool isTypeOk(const char* name) const {
|
||||
return m_filterType == "" || m_filterType == VlcPoint::type(name);
|
||||
}
|
||||
|
||||
// METHODS (from main)
|
||||
static string version() VL_MT_DISABLED;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public:
|
|||
string filename() const { return keyExtract(VL_CIK_FILENAME, m_name.c_str()); }
|
||||
string comment() const { return keyExtract(VL_CIK_COMMENT, m_name.c_str()); }
|
||||
string hier() const { return keyExtract(VL_CIK_HIER, m_name.c_str()); }
|
||||
string type() const { return keyExtract(VL_CIK_TYPE, m_name.c_str()); }
|
||||
string type() const { return type(m_name.c_str()); }
|
||||
string thresh() const {
|
||||
// string as maybe ""
|
||||
return keyExtract(VL_CIK_THRESH, m_name.c_str());
|
||||
|
|
@ -73,7 +73,7 @@ public:
|
|||
int lineno() const { return std::atoi(keyExtract(VL_CIK_LINENO, m_name.c_str()).c_str()); }
|
||||
int column() const { return std::atoi(keyExtract(VL_CIK_COLUMN, m_name.c_str()).c_str()); }
|
||||
// METHODS
|
||||
static bool isToggle(const char* name) { return keyExtract(VL_CIK_TYPE, name) == "toggle"; }
|
||||
static string type(const char* name) { return keyExtract(VL_CIK_TYPE, name); }
|
||||
static string keyExtract(const char* shortKey, const char* name) {
|
||||
// Hot function
|
||||
const size_t shortLen = std::strlen(shortKey);
|
||||
|
|
|
|||
|
|
@ -51,11 +51,8 @@ void VlcTop::readCoverage(const string& filename, bool nonfatal) {
|
|||
if (line[secspace] == '\'' && line[secspace + 1] == ' ') break;
|
||||
}
|
||||
const string point = line.substr(3, secspace - 3);
|
||||
if (opt.skipToggle() && VlcPoint::isToggle(point.c_str())) {
|
||||
continue;
|
||||
} else if (opt.toggleOnly() && !VlcPoint::isToggle(point.c_str())) {
|
||||
continue;
|
||||
}
|
||||
if (!opt.isTypeOk(point.c_str())) continue;
|
||||
|
||||
const uint64_t hits = std::atoll(line.c_str() + secspace + 1);
|
||||
// UINFO(9," point '"<<point<<"'"<<" "<<hits<<endl);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue