Add option to skip toggle or to take only toggle
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
This commit is contained in:
parent
2b0bdfa7dd
commit
8141e3c83d
|
|
@ -80,6 +80,8 @@ 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);
|
||||
parser.finalize();
|
||||
|
||||
// Parse parameters
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ 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
|
||||
// clang-format on
|
||||
|
||||
private:
|
||||
|
|
@ -69,6 +71,8 @@ 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; }
|
||||
|
||||
// METHODS (from main)
|
||||
static string version() VL_MT_DISABLED;
|
||||
|
|
|
|||
|
|
@ -73,6 +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 keyExtract(const char* shortKey, const char* name) {
|
||||
// Hot function
|
||||
const size_t shortLen = std::strlen(shortKey);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,11 @@ 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;
|
||||
}
|
||||
const uint64_t hits = std::atoll(line.c_str() + secspace + 1);
|
||||
// UINFO(9," point '"<<point<<"'"<<" "<<hits<<endl);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue