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
3cc9962a
Commit
3cc9962a
authored
Mar 11, 2020
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added Prefetchable object and related test
parent
59135965
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
0 deletions
+68
-0
include/hepnos/Prefetchable.hpp
include/hepnos/Prefetchable.hpp
+52
-0
include/hepnos/Prefetcher.hpp
include/hepnos/Prefetcher.hpp
+6
-0
test/RunSetTest.cpp
test/RunSetTest.cpp
+10
-0
No files found.
include/hepnos/Prefetchable.hpp
0 → 100644
View file @
3cc9962a
#ifndef __HEPNOS_PREFETCHABLE_HPP
#define __HEPNOS_PREFETCHABLE_HPP
#include <memory>
namespace
hepnos
{
class
Prefetcher
;
template
<
typename
Container
>
class
Prefetchable
{
friend
class
Prefetcher
;
public:
Prefetchable
(
const
Prefetchable
&
other
)
=
delete
;
Prefetchable
(
Prefetchable
&&
other
)
=
default
;
Prefetchable
&
operator
=
(
const
Prefetchable
&
other
)
=
delete
;
Prefetchable
&
operator
=
(
Prefetchable
&&
other
)
=
delete
;
~
Prefetchable
()
=
default
;
typename
Container
::
iterator
begin
()
{
return
m_container
.
begin
(
m_prefetcher
);
}
typename
Container
::
iterator
end
()
{
return
m_container
.
end
();
}
typename
Container
::
const_iterator
begin
()
const
{
return
m_container
.
begin
(
m_prefetcher
);
}
typename
Container
::
const_iterator
end
()
const
{
return
m_container
.
end
();
}
private:
Container
m_container
;
const
Prefetcher
&
m_prefetcher
;
Prefetchable
(
const
Container
&
c
,
const
Prefetcher
&
p
)
:
m_container
(
c
)
,
m_prefetcher
(
p
)
{}
};
}
#endif
include/hepnos/Prefetcher.hpp
View file @
3cc9962a
...
...
@@ -2,6 +2,7 @@
#define __HEPNOS_PREFETCHER_HPP
#include <memory>
#include <hepnos/Prefetchable.hpp>
namespace
hepnos
{
...
...
@@ -42,6 +43,11 @@ class Prefetcher {
void
setCacheSize
(
unsigned
int
size
);
unsigned
int
getBatchSize
()
const
;
void
setBatchSize
(
unsigned
int
size
);
template
<
typename
Container
>
Prefetchable
<
Container
>
operator
()(
const
Container
&
c
)
const
{
return
Prefetchable
<
Container
>
(
c
,
*
this
);
}
};
}
...
...
test/RunSetTest.cpp
View file @
3cc9962a
...
...
@@ -206,6 +206,16 @@ void RunSetTest::testPrefetcher() {
i
+=
1
;
}
}
// test begin/end using a Prefetchable object
{
Prefetcher
prefetch
(
*
datastore
);
unsigned
i
=
0
;
for
(
auto
&
r
:
prefetch
(
mds
.
runs
()))
{
CPPUNIT_ASSERT
(
r
.
valid
());
CPPUNIT_ASSERT
(
r
.
number
()
==
i
);
i
+=
1
;
}
}
// test lower_bound
{
Prefetcher
prefetcher
(
*
datastore
);
...
...
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