Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HEPnOS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
HEP
HEPnOS
Commits
5f577a11
Commit
5f577a11
authored
Mar 10, 2020
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prefetcher working for RunSet and Run
parent
0e3be1bc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
46 deletions
+183
-46
include/hepnos/Prefetcher.hpp
include/hepnos/Prefetcher.hpp
+6
-0
include/hepnos/Run.hpp
include/hepnos/Run.hpp
+2
-0
src/Run.cpp
src/Run.cpp
+104
-34
src/RunSet.cpp
src/RunSet.cpp
+27
-9
test/RunSetTest.cpp
test/RunSetTest.cpp
+1
-2
test/RunTest.cpp
test/RunTest.cpp
+43
-1
No files found.
include/hepnos/Prefetcher.hpp
View file @
5f577a11
...
@@ -9,10 +9,16 @@ class DataStore;
...
@@ -9,10 +9,16 @@ class DataStore;
class
PrefetcherImpl
;
class
PrefetcherImpl
;
class
AsyncEngine
;
class
AsyncEngine
;
class
RunSet
;
class
RunSet
;
class
EventSet
;
class
Run
;
class
SubRun
;
class
Prefetcher
{
class
Prefetcher
{
friend
class
RunSet
;
friend
class
RunSet
;
friend
class
EventSet
;
friend
class
Run
;
friend
class
SubRun
;
private:
private:
...
...
include/hepnos/Run.hpp
View file @
5f577a11
...
@@ -346,6 +346,8 @@ class Run : public KeyValueContainer {
...
@@ -346,6 +346,8 @@ class Run : public KeyValueContainer {
class
Run
::
const_iterator
{
class
Run
::
const_iterator
{
friend
class
Run
;
protected:
protected:
/**
/**
...
...
src/Run.cpp
View file @
5f577a11
...
@@ -6,14 +6,63 @@
...
@@ -6,14 +6,63 @@
#include "hepnos/Run.hpp"
#include "hepnos/Run.hpp"
#include "hepnos/DataSet.hpp"
#include "hepnos/DataSet.hpp"
#include "hepnos/AsyncEngine.hpp"
#include "hepnos/AsyncEngine.hpp"
#include "hepnos/Prefetcher.hpp"
#include "ItemImpl.hpp"
#include "ItemImpl.hpp"
#include "
Item
Impl.hpp"
#include "
Prefetcher
Impl.hpp"
#include "DataStoreImpl.hpp"
#include "DataStoreImpl.hpp"
#include "WriteBatchImpl.hpp"
#include "WriteBatchImpl.hpp"
#include "AsyncEngineImpl.hpp"
#include "AsyncEngineImpl.hpp"
namespace
hepnos
{
namespace
hepnos
{
////////////////////////////////////////////////////////////////////////////////////////////
// Run::const_iterator::Impl declaration
////////////////////////////////////////////////////////////////////////////////////////////
class
Run
::
const_iterator
::
Impl
{
friend
class
Run
;
public:
SubRun
m_current_subrun
;
std
::
shared_ptr
<
PrefetcherImpl
>
m_prefetcher
;
Impl
()
:
m_current_subrun
()
{}
Impl
(
const
SubRun
&
subrun
)
:
m_current_subrun
(
subrun
)
{}
Impl
(
SubRun
&&
subrun
)
:
m_current_subrun
(
std
::
move
(
subrun
))
{}
Impl
(
const
Impl
&
other
)
:
m_current_subrun
(
other
.
m_current_subrun
)
{}
~
Impl
()
{
if
(
m_prefetcher
)
m_prefetcher
->
m_associated
=
false
;
}
bool
operator
==
(
const
Impl
&
other
)
const
{
return
m_current_subrun
==
other
.
m_current_subrun
;
}
void
setPrefetcher
(
const
std
::
shared_ptr
<
PrefetcherImpl
>&
p
)
{
if
(
p
->
m_associated
)
throw
Exception
(
"Prefetcher object already in use"
);
if
(
m_prefetcher
)
m_prefetcher
->
m_associated
=
false
;
m_prefetcher
=
p
;
m_prefetcher
->
m_associated
=
true
;
}
};
static
Run
::
iterator
Run_end
;
static
Run
::
iterator
Run_end
;
Run
::
Run
()
Run
::
Run
()
...
@@ -175,6 +224,15 @@ Run::iterator Run::find(const SubRunNumber& subRunNumber) {
...
@@ -175,6 +224,15 @@ Run::iterator Run::find(const SubRunNumber& subRunNumber) {
return
iterator
(
SubRun
(
std
::
move
(
new_subrun_impl
)));
return
iterator
(
SubRun
(
std
::
move
(
new_subrun_impl
)));
}
}
Run
::
iterator
Run
::
find
(
const
SubRunNumber
&
subRunNumber
,
const
Prefetcher
&
prefetcher
)
{
auto
it
=
find
(
subRunNumber
);
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
SUBRUN
,
ItemType
::
RUN
,
it
.
m_impl
->
m_current_subrun
.
m_impl
);
}
return
it
;
}
Run
::
const_iterator
Run
::
find
(
const
SubRunNumber
&
subRunNumber
)
const
{
Run
::
const_iterator
Run
::
find
(
const
SubRunNumber
&
subRunNumber
)
const
{
iterator
it
=
const_cast
<
Run
*>
(
this
)
->
find
(
subRunNumber
);
iterator
it
=
const_cast
<
Run
*>
(
this
)
->
find
(
subRunNumber
);
return
it
;
return
it
;
...
@@ -194,6 +252,15 @@ Run::iterator Run::begin() {
...
@@ -194,6 +252,15 @@ Run::iterator Run::begin() {
else
return
end
();
else
return
end
();
}
}
Run
::
iterator
Run
::
begin
(
const
Prefetcher
&
prefetcher
)
{
auto
it
=
begin
();
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
SUBRUN
,
ItemType
::
RUN
,
it
.
m_impl
->
m_current_subrun
.
m_impl
);
}
return
it
;
}
Run
::
iterator
Run
::
end
()
{
Run
::
iterator
Run
::
end
()
{
if
(
!
valid
())
{
if
(
!
valid
())
{
throw
Exception
(
"Calling Run member function on an invalid Run object"
);
throw
Exception
(
"Calling Run member function on an invalid Run object"
);
...
@@ -205,6 +272,10 @@ Run::const_iterator Run::begin() const {
...
@@ -205,6 +272,10 @@ Run::const_iterator Run::begin() const {
return
const_iterator
(
const_cast
<
Run
*>
(
this
)
->
begin
());
return
const_iterator
(
const_cast
<
Run
*>
(
this
)
->
begin
());
}
}
Run
::
const_iterator
Run
::
begin
(
const
Prefetcher
&
prefetcher
)
const
{
return
const_iterator
(
const_cast
<
Run
*>
(
this
)
->
begin
(
prefetcher
));
}
Run
::
const_iterator
Run
::
end
()
const
{
Run
::
const_iterator
Run
::
end
()
const
{
if
(
!
valid
())
{
if
(
!
valid
())
{
throw
Exception
(
"Calling Run member function on an invalid Run object"
);
throw
Exception
(
"Calling Run member function on an invalid Run object"
);
...
@@ -216,6 +287,10 @@ Run::const_iterator Run::cbegin() const {
...
@@ -216,6 +287,10 @@ Run::const_iterator Run::cbegin() const {
return
const_iterator
(
const_cast
<
Run
*>
(
this
)
->
begin
());
return
const_iterator
(
const_cast
<
Run
*>
(
this
)
->
begin
());
}
}
Run
::
const_iterator
Run
::
cbegin
(
const
Prefetcher
&
prefetcher
)
const
{
return
const_iterator
(
const_cast
<
Run
*>
(
this
)
->
begin
(
prefetcher
));
}
Run
::
const_iterator
Run
::
cend
()
const
{
Run
::
const_iterator
Run
::
cend
()
const
{
if
(
!
valid
())
{
if
(
!
valid
())
{
throw
Exception
(
"Calling Run member function on an invalid Run object"
);
throw
Exception
(
"Calling Run member function on an invalid Run object"
);
...
@@ -251,11 +326,23 @@ Run::iterator Run::lower_bound(const SubRunNumber& lb) {
...
@@ -251,11 +326,23 @@ Run::iterator Run::lower_bound(const SubRunNumber& lb) {
}
}
}
}
Run
::
const_iterator
Run
::
lower_bound
(
const
SubRunNumber
&
lb
)
const
{
Run
::
iterator
Run
::
lower_bound
(
const
SubRunNumber
&
lb
,
const
Prefetcher
&
prefetcher
)
{
iterator
it
=
const_cast
<
Run
*>
(
this
)
->
lower_bound
(
lb
);
auto
it
=
lower_bound
(
lb
);
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
SUBRUN
,
ItemType
::
RUN
,
it
.
m_impl
->
m_current_subrun
.
m_impl
);
}
return
it
;
return
it
;
}
}
Run
::
const_iterator
Run
::
lower_bound
(
const
SubRunNumber
&
lb
)
const
{
return
const_cast
<
Run
*>
(
this
)
->
lower_bound
(
lb
);
}
Run
::
const_iterator
Run
::
lower_bound
(
const
SubRunNumber
&
lb
,
const
Prefetcher
&
prefetcher
)
const
{
return
const_cast
<
Run
*>
(
this
)
->
lower_bound
(
lb
,
prefetcher
);
}
Run
::
iterator
Run
::
upper_bound
(
const
SubRunNumber
&
ub
)
{
Run
::
iterator
Run
::
upper_bound
(
const
SubRunNumber
&
ub
)
{
if
(
!
valid
())
{
if
(
!
valid
())
{
throw
Exception
(
"Calling Run member function on an invalid Run object"
);
throw
Exception
(
"Calling Run member function on an invalid Run object"
);
...
@@ -268,11 +355,23 @@ Run::iterator Run::upper_bound(const SubRunNumber& ub) {
...
@@ -268,11 +355,23 @@ Run::iterator Run::upper_bound(const SubRunNumber& ub) {
else
return
iterator
(
subrun
);
else
return
iterator
(
subrun
);
}
}
Run
::
const_iterator
Run
::
upper_bound
(
const
SubRunNumber
&
ub
)
const
{
Run
::
iterator
Run
::
upper_bound
(
const
SubRunNumber
&
ub
,
const
Prefetcher
&
prefetcher
)
{
iterator
it
=
const_cast
<
Run
*>
(
this
)
->
upper_bound
(
ub
);
auto
it
=
upper_bound
(
ub
);
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
SUBRUN
,
ItemType
::
RUN
,
it
.
m_impl
->
m_current_subrun
.
m_impl
);
}
return
it
;
return
it
;
}
}
Run
::
const_iterator
Run
::
upper_bound
(
const
SubRunNumber
&
ub
)
const
{
return
const_cast
<
Run
*>
(
this
)
->
upper_bound
(
ub
);
}
Run
::
const_iterator
Run
::
upper_bound
(
const
SubRunNumber
&
ub
,
const
Prefetcher
&
prefetcher
)
const
{
return
const_cast
<
Run
*>
(
this
)
->
upper_bound
(
ub
,
prefetcher
);
}
void
Run
::
toDescriptor
(
RunDescriptor
&
descriptor
)
{
void
Run
::
toDescriptor
(
RunDescriptor
&
descriptor
)
{
std
::
memset
(
descriptor
.
data
,
0
,
sizeof
(
descriptor
.
data
));
std
::
memset
(
descriptor
.
data
,
0
,
sizeof
(
descriptor
.
data
));
if
(
!
valid
())
return
;
if
(
!
valid
())
return
;
...
@@ -288,35 +387,6 @@ Run Run::fromDescriptor(const DataStore& datastore, const RunDescriptor& descrip
...
@@ -288,35 +387,6 @@ Run Run::fromDescriptor(const DataStore& datastore, const RunDescriptor& descrip
else
return
Run
();
else
return
Run
();
}
}
////////////////////////////////////////////////////////////////////////////////////////////
// Run::const_iterator::Impl implementation
////////////////////////////////////////////////////////////////////////////////////////////
class
Run
::
const_iterator
::
Impl
{
public:
SubRun
m_current_subrun
;
Impl
()
:
m_current_subrun
()
{}
Impl
(
const
SubRun
&
subrun
)
:
m_current_subrun
(
subrun
)
{}
Impl
(
SubRun
&&
subrun
)
:
m_current_subrun
(
std
::
move
(
subrun
))
{}
Impl
(
const
Impl
&
other
)
:
m_current_subrun
(
other
.
m_current_subrun
)
{}
bool
operator
==
(
const
Impl
&
other
)
const
{
return
m_current_subrun
==
other
.
m_current_subrun
;
}
};
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
// Run::const_iterator implementation
// Run::const_iterator implementation
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
...
...
src/RunSet.cpp
View file @
5f577a11
...
@@ -97,8 +97,10 @@ RunSet::iterator RunSet::find(const RunNumber& runNumber) {
...
@@ -97,8 +97,10 @@ RunSet::iterator RunSet::find(const RunNumber& runNumber) {
RunSet
::
iterator
RunSet
::
find
(
const
RunNumber
&
runNumber
,
const
Prefetcher
&
prefetcher
)
{
RunSet
::
iterator
RunSet
::
find
(
const
RunNumber
&
runNumber
,
const
Prefetcher
&
prefetcher
)
{
auto
it
=
find
(
runNumber
);
auto
it
=
find
(
runNumber
);
if
(
it
!=
end
())
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
RUN
,
ItemType
::
DATASET
,
it
.
m_impl
->
m_current_run
.
m_impl
);
}
return
it
;
return
it
;
}
}
...
@@ -109,8 +111,10 @@ RunSet::const_iterator RunSet::find(const RunNumber& runNumber) const {
...
@@ -109,8 +111,10 @@ RunSet::const_iterator RunSet::find(const RunNumber& runNumber) const {
RunSet
::
const_iterator
RunSet
::
find
(
const
RunNumber
&
runNumber
,
const
Prefetcher
&
prefetcher
)
const
{
RunSet
::
const_iterator
RunSet
::
find
(
const
RunNumber
&
runNumber
,
const
Prefetcher
&
prefetcher
)
const
{
iterator
it
=
const_cast
<
RunSet
*>
(
this
)
->
find
(
runNumber
);
iterator
it
=
const_cast
<
RunSet
*>
(
this
)
->
find
(
runNumber
);
if
(
it
!=
end
())
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
RUN
,
ItemType
::
DATASET
,
it
.
m_impl
->
m_current_run
.
m_impl
);
}
return
it
;
return
it
;
}
}
...
@@ -130,8 +134,10 @@ RunSet::iterator RunSet::begin() {
...
@@ -130,8 +134,10 @@ RunSet::iterator RunSet::begin() {
RunSet
::
iterator
RunSet
::
begin
(
const
Prefetcher
&
prefetcher
)
{
RunSet
::
iterator
RunSet
::
begin
(
const
Prefetcher
&
prefetcher
)
{
auto
it
=
begin
();
auto
it
=
begin
();
if
(
it
!=
end
())
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
RUN
,
ItemType
::
DATASET
,
it
.
m_impl
->
m_current_run
.
m_impl
);
}
return
it
;
return
it
;
}
}
...
@@ -145,8 +151,10 @@ RunSet::const_iterator RunSet::cbegin() const {
...
@@ -145,8 +151,10 @@ RunSet::const_iterator RunSet::cbegin() const {
RunSet
::
const_iterator
RunSet
::
cbegin
(
const
Prefetcher
&
prefetcher
)
const
{
RunSet
::
const_iterator
RunSet
::
cbegin
(
const
Prefetcher
&
prefetcher
)
const
{
auto
it
=
cbegin
();
auto
it
=
cbegin
();
if
(
it
!=
cend
())
if
(
it
!=
cend
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
RUN
,
ItemType
::
DATASET
,
it
.
m_impl
->
m_current_run
.
m_impl
);
}
return
it
;
return
it
;
}
}
...
@@ -160,8 +168,10 @@ RunSet::const_iterator RunSet::begin() const {
...
@@ -160,8 +168,10 @@ RunSet::const_iterator RunSet::begin() const {
RunSet
::
const_iterator
RunSet
::
begin
(
const
Prefetcher
&
prefetcher
)
const
{
RunSet
::
const_iterator
RunSet
::
begin
(
const
Prefetcher
&
prefetcher
)
const
{
auto
it
=
const_iterator
(
const_cast
<
RunSet
*>
(
this
)
->
begin
());
auto
it
=
const_iterator
(
const_cast
<
RunSet
*>
(
this
)
->
begin
());
if
(
it
!=
end
())
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
RUN
,
ItemType
::
DATASET
,
it
.
m_impl
->
m_current_run
.
m_impl
);
}
return
it
;
return
it
;
}
}
...
@@ -199,8 +209,10 @@ RunSet::iterator RunSet::lower_bound(const RunNumber& lb) {
...
@@ -199,8 +209,10 @@ RunSet::iterator RunSet::lower_bound(const RunNumber& lb) {
RunSet
::
iterator
RunSet
::
lower_bound
(
const
RunNumber
&
lb
,
const
Prefetcher
&
prefetcher
)
{
RunSet
::
iterator
RunSet
::
lower_bound
(
const
RunNumber
&
lb
,
const
Prefetcher
&
prefetcher
)
{
auto
it
=
lower_bound
(
lb
);
auto
it
=
lower_bound
(
lb
);
if
(
it
!=
end
())
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
RUN
,
ItemType
::
DATASET
,
it
.
m_impl
->
m_current_run
.
m_impl
);
}
return
it
;
return
it
;
}
}
...
@@ -211,8 +223,10 @@ RunSet::const_iterator RunSet::lower_bound(const RunNumber& lb) const {
...
@@ -211,8 +223,10 @@ RunSet::const_iterator RunSet::lower_bound(const RunNumber& lb) const {
RunSet
::
const_iterator
RunSet
::
lower_bound
(
const
RunNumber
&
lb
,
const
Prefetcher
&
prefetcher
)
const
{
RunSet
::
const_iterator
RunSet
::
lower_bound
(
const
RunNumber
&
lb
,
const
Prefetcher
&
prefetcher
)
const
{
iterator
it
=
const_cast
<
RunSet
*>
(
this
)
->
lower_bound
(
lb
);
iterator
it
=
const_cast
<
RunSet
*>
(
this
)
->
lower_bound
(
lb
);
if
(
it
!=
end
())
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
RUN
,
ItemType
::
DATASET
,
it
.
m_impl
->
m_current_run
.
m_impl
);
}
return
it
;
return
it
;
}
}
...
@@ -226,8 +240,10 @@ RunSet::iterator RunSet::upper_bound(const RunNumber& ub) {
...
@@ -226,8 +240,10 @@ RunSet::iterator RunSet::upper_bound(const RunNumber& ub) {
RunSet
::
iterator
RunSet
::
upper_bound
(
const
RunNumber
&
ub
,
const
Prefetcher
&
prefetcher
)
{
RunSet
::
iterator
RunSet
::
upper_bound
(
const
RunNumber
&
ub
,
const
Prefetcher
&
prefetcher
)
{
auto
it
=
upper_bound
(
ub
);
auto
it
=
upper_bound
(
ub
);
if
(
it
!=
end
())
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
RUN
,
ItemType
::
DATASET
,
it
.
m_impl
->
m_current_run
.
m_impl
);
}
return
it
;
return
it
;
}
}
...
@@ -239,8 +255,10 @@ RunSet::const_iterator RunSet::upper_bound(const RunNumber& ub) const {
...
@@ -239,8 +255,10 @@ RunSet::const_iterator RunSet::upper_bound(const RunNumber& ub) const {
RunSet
::
const_iterator
RunSet
::
upper_bound
(
const
RunNumber
&
ub
,
const
Prefetcher
&
prefetcher
)
const
{
RunSet
::
const_iterator
RunSet
::
upper_bound
(
const
RunNumber
&
ub
,
const
Prefetcher
&
prefetcher
)
const
{
iterator
it
=
const_cast
<
RunSet
*>
(
this
)
->
upper_bound
(
ub
);
iterator
it
=
const_cast
<
RunSet
*>
(
this
)
->
upper_bound
(
ub
);
if
(
it
!=
end
())
if
(
it
!=
end
())
{
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
it
.
m_impl
->
setPrefetcher
(
prefetcher
.
m_impl
);
prefetcher
.
m_impl
->
prefetchFrom
(
ItemType
::
RUN
,
ItemType
::
DATASET
,
it
.
m_impl
->
m_current_run
.
m_impl
);
}
return
it
;
return
it
;
}
}
...
...
test/RunSetTest.cpp
View file @
5f577a11
...
@@ -206,7 +206,6 @@ void RunSetTest::testPrefetcher() {
...
@@ -206,7 +206,6 @@ void RunSetTest::testPrefetcher() {
i
+=
1
;
i
+=
1
;
}
}
}
}
// test lower_bound
// test lower_bound
{
{
Prefetcher
prefetcher
(
*
datastore
);
Prefetcher
prefetcher
(
*
datastore
);
...
@@ -218,7 +217,7 @@ void RunSetTest::testPrefetcher() {
...
@@ -218,7 +217,7 @@ void RunSetTest::testPrefetcher() {
i
+=
1
;
i
+=
1
;
}
}
}
}
// test
low
er_bound
// test
upp
er_bound
{
{
Prefetcher
prefetcher
(
*
datastore
);
Prefetcher
prefetcher
(
*
datastore
);
unsigned
i
=
6
;
unsigned
i
=
6
;
...
...
test/RunTest.cpp
View file @
5f577a11
...
@@ -199,5 +199,47 @@ void RunTest::testAsync() {
...
@@ -199,5 +199,47 @@ void RunTest::testAsync() {
}
}
void
RunTest
::
testPrefetcher
()
{
void
RunTest
::
testPrefetcher
()
{
// TODO
auto
root
=
datastore
->
root
();
DataSet
mds
=
root
.
createDataSet
(
"matthieu_prefetch"
);
CPPUNIT_ASSERT
(
mds
.
valid
());
Run
r
=
mds
.
createRun
(
42
);
CPPUNIT_ASSERT
(
r
.
valid
());
for
(
unsigned
i
=
0
;
i
<
20
;
i
++
)
{
SubRun
sr
=
r
.
createSubRun
(
i
);
CPPUNIT_ASSERT
(
sr
.
valid
());
}
// test begin/end
{
Prefetcher
prefetcher
(
*
datastore
);
unsigned
i
=
0
;
for
(
auto
it
=
r
.
begin
(
prefetcher
);
it
!=
r
.
end
();
it
++
)
{
CPPUNIT_ASSERT
(
it
->
valid
());
CPPUNIT_ASSERT
(
it
->
number
()
==
i
);
i
+=
1
;
}
}
// test lower_bound
{
Prefetcher
prefetcher
(
*
datastore
);
unsigned
i
=
5
;
auto
it
=
r
.
lower_bound
(
5
);
for
(;
it
!=
r
.
end
();
it
++
)
{
CPPUNIT_ASSERT
(
it
->
valid
());
CPPUNIT_ASSERT
(
it
->
number
()
==
i
);
i
+=
1
;
}
}
// test upper_bound
{
Prefetcher
prefetcher
(
*
datastore
);
unsigned
i
=
6
;
auto
it
=
r
.
upper_bound
(
5
);
for
(;
it
!=
r
.
end
();
it
++
)
{
CPPUNIT_ASSERT
(
it
->
valid
());
CPPUNIT_ASSERT
(
it
->
number
()
==
i
);
i
+=
1
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment