Professional Documents
Culture Documents
I Jcs It 2016070619
I Jcs It 2016070619
7 (6) , 2016,2469-2471
Abstract— The Performance Analysis of Constraint Engine is While in some cases it is impossible to provide the
the work done to discover new Optimization methods for distribution to multiple values, there needs to be a ‘best
Optimizing Perl modules case’ effort by the tool to provide the distribution requested.
5. Provide an interface for selecting random values
Keywords— Optimization, Constraint Engine with constraints in a test
The constraint engine also will provide a mechanism for
I. INTRODUCTION tests to select random values for build parameters and
In order to determine if tests can be merged together into specify constraints on those parameters within a single test.
a single job it is necessary to know the requirements of the This is a useful mechanism for test authors to more easily
template to run correctly, and resolve the competing add randomness to their tests while putting limits on the
requirements of templates for shared resources such as randomness.
memory locations, template build options, API options and
DUT configuration settings. The constraint engine provides III. GROUNDWORK AND DEFINITIONS
the functionality of taking in all the requirements for tests Parameters and Options
and finding a solution that meets the user’s requests both in A parameter is a variable that is assigned a value by the
terms of absolute requirements and also in terms of CE. An option is a possible value that the parameter may
probabilistic goals set by the users. Constraint Engine is take. Parameters may have multiple options, and the
part of Migi Tool options can have weights which affect the probability of
which option is chosen.
II. GOALS An option can depend on the value of other parameters.
1. Track usage of shared resources to avoid building All options will be evaluated by the Perl interpreter and
tests that cannot run together successfully therefore may contain arbitrary Perl code that references the
This is the minimum functionality – without this we values of other parameters.
can’t do test merging without the majority of merged tests Constraints
failing due to conflicts over shared resources such as A constraint is a restriction that is imposed on the space
memory, shared control registers and APIs that might affect of parameter values. Constraints are in the form of arbitrary
or check more than one thread. Perl code that will be evaluated. If the code evaluates to
2. Provide globally optimal allocation of shared true (non-zero), the constraint is said to be satisfied.
resources where possible Streams
We want to make globally-aware decisions about the A stream is a series of software instructions that executes
shared resources (and decisions that affect a test’s use of on a single LP (logical processor). It will contain
those shared resources) so that a random choice doesn’t parameters, and constraints that pick combinations of
unnecessarily restrict our ability to run tests. Historical parameter values the stream needs to run.
experience from MTMerge and previous MP test generation Tests
tools strongly indicate that non-global allocation in this A test is a container for one or more streams. Tests can
space is undesirable. also contain parameters and constraints that pick
3. Provide tests dynamically combinations of parameter values the test needs to start
Determining the runtime of a test is impossible without building.
running the test on the MUT (it’s the halting problem.) We Tests waiting to run are kept in a priority queue. This
also believe that it is extremely likely that we will often means that in general, higher priority tests will run before
have threads on the MUT that will be idle for nontrivial lower priority tests as long as constraints are not blocking
periods of time. We wish to reuse that simulation time to do the higher priority tests.
useful testing, so the constraint engine must be capable of Test blocks
allocating resources to a new test after other tests have been A test block is a container for one or more tests. Test
deployed on the system. blocks can be layered, meaning containing other test blocks.
4. Provide statistically significant solutions Constraints can also be specified for test blocks, with the
Users will be specifying parameters that can take on one intention that those constraints will be copied into every
of many values, and in many cases the distribution of those stream inside, and evaluated inside the stream.
values over many runs of tests is significant to the user.
www.ijcsit.com 2469
Siva Kumar Kotamraju et al, / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 7 (6) , 2016,2469-2471
Parallel merge blocks contain tests that should run 2) As logical processors become available, some
concurrently. For any test in the merge block to build and WAITING tests will be promoted to BUILDING. If the CE
run, all tests in the merge block must also build and run. cannot solve the constraint system with these new tests, the
tests will return to WAITING. Tests are returned to the
Serial merge blocks contain tests that should run in series, WAITING queue lowest priority first, until the constraint
one after another, in the order specified. system can be solved.
Parameter / Constraint Interdependencies
Merge blocks can also contain other merge blocks, Parameters and constraints are concepts with many
meaning merge blocks can be layered. interdependencies. The following relationships exist:
Implementing serial merge blocks is difficult, and may 1) Constraints are arbitrary sections of Perl code that
not be done unless there is demand for the feature. check whether parameters satisfy certain properties. As
Furthermore, from here, if the term merge block is used such, they are dependent on the parameters they reference.
without specifying the type, it is referring to parallel merge
blocks The CE must be aware of the parameters a constraint is
dependent on so that if a constraint evaluates to false
Test Queues (indicating that it is unhappy with one or more of the
Every test has a status, which can be one of the following: parameters), the CE can then pick different options for
some of the dependent parameters in an effort to satisfy the
RUNNING The test has been reported as running by constraint.
the Migi Control. For a test to reach this state, it must have
built correctly, meaning all of its constraints are satisfied 2) Parameters are related to constraints. If a
and all of its parameters are "locked" (they can no longer parameter changes, the CE must know all of the constraints
change their value.) that referenced that parameter so that those constraints can
BUILDING The test is either ready to build or be re-evaluated.
currently building. For a test to stay in this queue, all of its
constraints must be satisfied. Updates to parameters 3) A parameter can be dependent on other
throughout the build process may cause constraints to fail, parameters. Because an option for a parameter may depend
which would cause removal of the test from the on the values of other parameters, changing one parameter
BUILDING queue. can affect the values of several other parameters. Every
WAITING The test is currently failing some of its time the CE changes the value of a parameter, it needs to
constraints and cannot be built right now. The failing check which other parameters depend on it, so those
constraints could be system-imposed (no logical processors parameters can be re-evaluated.
are available for the test), or user-imposed (the user may
have requested the test run alone on a core.) IV. OPTIMIZATION TECHNIQUES:
WAITING -> BUILDING (promotion) 1) String Comparison:
When logical processors in the system are available, The code inside the subroutine does arithmetic and a
some WAITING tests will be promoted to BUILDING. numeric comparison of two strings. It assigns one string to
The CE will then attempt to solve the constraint system. If another if the condition tests true but the condition always
successful, the tests added to the BUILDING queue will tests false.
remain, indicating they are ready to build. If adding the sub test_code{
new tests causes the constraint system to fail, tests will be my ($a,$b) = qw(foo bar);
removed (and put back in the WAITING queue) until the my $c;
constraint system can be solved. if ($a == $b) {
$c = $a;
BUILDING -> RUNNING (promotion) }
When the Migi Control indicates a test will run, it is }
promoted to RUNNING. Once a test is in the RUNNING
queue, it will remain there until the Migi Control tells the Now let's fix the comparison the way it should be, by
CE to release the test (probably because the test finished replacing == with eq, so we get:
running.)
my ($a,$b) = qw(foo bar);
BUILDING -> WAITING my $c;
This transition can happen in two cases if ($a eq $b) {
$c = $a;
www.ijcsit.com 2470
Siva Kumar Kotamraju et al, / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 7 (6) , 2016,2469-2471
4) Needless importing : 20
lve
e
ck
ts
st
ck
ick
st
AD
t
s
in
at
c
fie
ue
tio
es
te
ie
io
pi
pi
so
ep
ra
ep
lu
LO
nc
d_
pt
tis
re
re
::t
eq
va
::_
st
::r
::r
_o
_o
t::
de
ck
t::
sa
ad
TO
on
_r
::e
am
CE
ck
es
ew
in
al
lo
t::
en
s_
ss
_c
l
lo
U
ra
ev
va
tb
::T
in
tre
i::
_n
ce
ep
es
::A
tb
al
st
es
ra
ig
e_
::E
CE
:S
ev
es
ck
ro
on
oc
_d
M
on
st
:T
at
E:
5) Avoid $&:
CE
::p
pi
t::
::T
on
pr
::C
i::
ct
E:
m
er
C
r::
in
ig
ra
:_
CE
CE
::C
i::
om
C
en
CE
i::
ra
te
M
E:
xt
ig
i::
ig
i::
::g
CE
e
st
i::
:C
::e
M
ig
C
i::
M
am
ig
on
ig
i::
M
er
ig
E:
er
i::
M
$text =~ /.* rules/; $line = $&; # Now every match will
M
ig
M
::C
ar
et
C
ig
et
M
am
::P
i::
M
am
CE
ig
CE
ar
M
ar
i::
::P
::P
ig
i::
copy $& slow
ig
CE
CE
M
i::
i::
ig
ig
M
M
$text =~ /(.* rules)/; $line = $1; # Didn't mention $& fast Subroutine
Optimized Constraint.pm in CE
6) Pull things out of loops:
Perl's hash lookups are fast. But they aren't as fast as a 30_Parallel_merge_advanced.test
lexical variable. The value of $type didn't change, so I
120
pulled the lookup out above the loop into a lexical variable.
my $type_func = $encode_types{$type}; 100
Percentage of time
80
Series1
7) Transliteration operator: 60
Series2
Series3
n
t
s
n
d
te
t
ck
AD
st
ts
ck
in
es
ie
io
io
ic
ic
fie
lv
ue
ua
es
ra
pi
pi
nc
pt
pt
ep
ep
_t
so
LO
• tr/q/Q/ faster than s/q/Q/g: tr is also faster than the
is
re
re
st
:: t
eq
al
_o
_o
d
de
t
::r
::r
:_
sa
on
t::
ev
ck
ad
t::
TO
_r
al
w
E:
am
ck
en
in
es
t::
lo
_c
l::
s_
ss
ev
ne
AU
C
lo
a
in
ep
tb
a
:T
al
r
es
i::
ce
e_
tb
k_
v
st
r
ra
es
E:
:
St
:E
_d
v
ig
on
::e
at
ic
st
:T
C
M
E:
ct
E:
: :p
:p
on
:T
er
pr
:C
i::
m
t
E:
ra
in
::C
E:
C
E:
en
:_
er
ig
:C
om
E:
C
ra
xt
i::
C
E:
gi
C
et
::g
i::
C
E:
st
::e
ig
i::
:C
i::
am
C
i ::
ig
M
on
C
M
er
ig
er
substitutions.
ig
i ::
E:
ig
M
i ::
M
et
ar
:C
M
et
ig
C
ig
am
M
:P
am
E:
i ::
M
ig
E:
C
ar
ar
M
i::
:P
:P
ig
i::
E:
M
ig
C
M
C
i::
i::
ig
ig
M
www.ijcsit.com 2471