Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
38e53b4f
Commit
38e53b4f
authored
9 years ago
by
Radovan Červený
Browse files
Options
Downloads
Patches
Plain Diff
modified adeterminize2 to use new measurements, introduced helper for convenient tool env setup
parent
5c0c280a
No related branches found
No related tags found
1 merge request
!14
BP_cervera3 - new measurements
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
adeterminize2/src/adeterminize.cpp
+16
-13
16 additions, 13 deletions
adeterminize2/src/adeterminize.cpp
alib2algo/src/measurements/MeasurementCmdLine.hpp
+58
-0
58 additions, 0 deletions
alib2algo/src/measurements/MeasurementCmdLine.hpp
with
74 additions
and
13 deletions
adeterminize2/src/adeterminize.cpp
+
16
−
13
View file @
38e53b4f
...
...
@@ -13,6 +13,9 @@
#include
"exception/AlibException.h"
#include
"automaton/determinize/Determinize.h"
#include
"measurements/measurements.hpp"
#include
"measurements/MeasurementCmdLine.hpp"
int
main
(
int
argc
,
char
**
argv
)
{
try
{
TCLAP
::
CmdLine
cmd
(
"Automaton determinize binary"
,
' '
,
"0.01"
);
...
...
@@ -20,21 +23,21 @@ int main(int argc, char** argv) {
TCLAP
::
ValueArg
<
std
::
string
>
input
(
"i"
,
"input"
,
"Automaton to determinize"
,
false
,
"-"
,
"file"
);
cmd
.
add
(
input
);
TCLAP
::
SwitchArg
measure
(
"m"
,
"measure"
,
"Measure times"
,
false
);
cmd
.
add
(
measure
);
measurements
::
MeasurementCmdLine
::
setupTCLAPArgs
(
cmd
);
TCLAP
::
SwitchArg
verbose
(
"v"
,
"verbose"
,
"Be verbose"
,
false
);
cmd
.
add
(
verbose
);
cmd
.
parse
(
argc
,
argv
);
measurements
::
MeasurementCmdLine
::
setupGlobalData
();
if
(
verbose
.
isSet
())
common
::
GlobalData
::
verbose
=
true
;
if
(
measure
.
isSet
())
common
::
GlobalData
::
measure
=
true
;
std
::
chrono
::
measurements
::
start
(
"Overal"
,
std
::
chrono
::
measurements
::
Type
::
OVERALL
);
std
::
chrono
::
measurements
::
start
(
"Input read"
,
std
::
chrono
::
measurements
::
Type
::
AUXILARY
);
measurements
::
start
(
"Overal"
,
measurements
::
Type
::
OVERALL
);
measurements
::
start
(
"Input read"
,
measurements
::
Type
::
AUXILIARY
);
std
::
deque
<
sax
::
Token
>
tokens
;
if
(
input
.
isSet
())
{
...
...
@@ -49,20 +52,20 @@ int main(int argc, char** argv) {
automaton
::
Automaton
automaton
=
alib
::
XmlDataFactory
::
fromTokens
<
automaton
::
Automaton
>
(
tokens
);
std
::
chrono
::
measurements
::
end
();
std
::
chrono
::
measurements
::
start
(
"Algorithm"
,
std
::
chrono
::
measurements
::
Type
::
MAIN
);
measurements
::
end
();
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
automaton
::
Automaton
res
=
automaton
::
determinize
::
Determinize
::
determinize
(
automaton
);
std
::
chrono
::
measurements
::
end
();
std
::
chrono
::
measurements
::
start
(
"Output write"
,
std
::
chrono
::
measurements
::
Type
::
AUXILARY
);
measurements
::
end
();
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXIL
I
ARY
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
std
::
chrono
::
measurements
::
end
();
std
::
chrono
::
measurements
::
end
();
measurements
::
end
();
measurements
::
end
();
if
(
measure
.
getValue
())
std
::
clog
<<
std
::
chrono
::
measurements
::
results
()
<<
std
::
endl
;
measure
ments
::
MeasurementCmdLine
::
outputMeasurements
()
;
return
0
;
}
catch
(
const
exception
::
AlibException
&
exception
)
{
...
...
This diff is collapsed.
Click to expand it.
alib2algo/src/measurements/MeasurementCmdLine.hpp
0 → 100644
+
58
−
0
View file @
38e53b4f
/*
*
Author
:
Radovan
Cerveny
*/
#ifndef MEASUREMENT_CMD_LINE_HPP_
#define MEASUREMENT_CMD_LINE_HPP_
#include
<tclap/CmdLine.h>
#include
<common/GlobalData.h>
#include
<vector>
#include
"sax/SaxComposeInterface.h"
#include
"measurements.hpp"
#include
"MeasurementResults.hpp"
namespace
measurements
{
class
MeasurementCmdLine
{
TCLAP
::
SwitchArg
measure
;
std
::
vector
<
std
::
string
>
measurementOutputOptions
;
TCLAP
::
ValuesConstraint
<
std
::
string
>
measurementOutputOptionsVals
;
TCLAP
::
ValueArg
<
std
::
string
>
measurementOutput
;
MeasurementCmdLine
(
)
:
measure
(
"m"
,
"measure"
,
"Measure times"
,
false
),
measurementOutputOptions
{
"list"
,
"tree"
,
"xml"
},
measurementOutputOptionsVals
(
measurementOutputOptions
),
measurementOutput
(
""
,
"measurement-output"
,
"How to output measurement data"
,
false
,
"list"
,
&
measurementOutputOptionsVals
)
{}
static
MeasurementCmdLine
INSTANCE
;
public:
static
void
setupTCLAPArgs
(
TCLAP
::
CmdLine
&
cmd
)
{
cmd
.
add
(
INSTANCE
.
measure
);
cmd
.
add
(
INSTANCE
.
measurementOutput
);
}
static
void
setupGlobalData
(
)
{
if
(
INSTANCE
.
measure
.
isSet
(
)
)
common
::
GlobalData
::
measure
=
true
;
}
static
void
outputMeasurements
(
)
{
if
(
INSTANCE
.
measure
.
getValue
(
)
)
{
const
std
::
string
&
output
=
INSTANCE
.
measurementOutput
.
getValue
(
);
if
(
output
==
"list"
)
std
::
clog
<<
measurements
::
MeasurementFormat
::
LIST
<<
measurements
::
results
(
)
<<
std
::
endl
;
else
if
(
output
==
"tree"
)
std
::
clog
<<
measurements
::
MeasurementFormat
::
TREE
<<
measurements
::
results
(
)
<<
std
::
endl
;
else
if
(
output
==
"xml"
)
std
::
clog
<<
measurements
::
MeasurementFormat
::
XML
<<
measurements
::
results
(
)
<<
std
::
endl
;
}
}
};
MeasurementCmdLine
MeasurementCmdLine
::
INSTANCE
;
}
#endif
/* MEASUREMENT_CMD_LINE_HPP_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment