Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
ff09c1fe
Commit
ff09c1fe
authored
5 years ago
by
Klaus Zenker (HZDR)
Committed by
Zenker, Dr. Klaus (FWKE) - 126506
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add time information for the history buffers.
parent
29d427bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/include/ServerHistory.h
+15
-4
15 additions, 4 deletions
Modules/include/ServerHistory.h
Modules/src/ServerHistory.cc
+23
-7
23 additions, 7 deletions
Modules/src/ServerHistory.cc
with
38 additions
and
11 deletions
Modules/include/ServerHistory.h
+
15
−
4
View file @
ff09c1fe
...
...
@@ -85,14 +85,24 @@ namespace ChimeraTK { namespace history {
struct
AccessorAttacher
;
template
<
typename
UserType
>
struct
HistoryEntry
{
HistoryEntry
(
bool
enableHistory
)
:
data
(
std
::
vector
<
ArrayOutput
<
UserType
>
>
{}),
timeStamp
(
std
::
vector
<
ArrayOutput
<
uint64_t
>
>
{}),
withTimeStamps
(
enableHistory
){
}
std
::
vector
<
ArrayOutput
<
UserType
>
>
data
;
std
::
vector
<
ArrayOutput
<
uint64_t
>
>
timeStamp
;
bool
withTimeStamps
;
};
struct
ServerHistory
:
public
ApplicationModule
{
ServerHistory
(
EntityOwner
*
owner
,
const
std
::
string
&
name
,
const
std
::
string
&
description
,
size_t
historyLength
=
1200
,
bool
eliminateHierarchy
=
false
,
const
std
::
unordered_set
<
std
::
string
>&
tags
=
{})
:
ApplicationModule
(
owner
,
name
,
description
,
eliminateHierarchy
,
tags
),
_historyLength
(
historyLength
)
{
}
size_t
historyLength
=
1200
,
bool
enableTimeStamps
=
false
,
bool
eliminateHierarchy
=
false
,
const
std
::
unordered_set
<
std
::
string
>&
tags
=
{})
:
ApplicationModule
(
owner
,
name
,
description
,
eliminateHierarchy
,
tags
),
_historyLength
(
historyLength
)
,
_enbaleTimeStamps
(
enableTimeStamps
)
{
}
/** Default constructor, creates a non-working module. Can be used for late
* initialisation. */
ServerHistory
()
:
_historyLength
(
1200
)
{}
ServerHistory
()
:
_historyLength
(
1200
)
,
_enbaleTimeStamps
(
false
)
{}
/** Add a Module as a source to this History module. */
void
addSource
(
const
Module
&
source
,
const
RegisterPath
&
namePrefix
,
const
VariableNetworkNode
&
trigger
=
{});
...
...
@@ -111,7 +121,7 @@ namespace ChimeraTK { namespace history {
* ArrayPushInput and ArrayOutput accessors. These accessors are dynamically
* created by the AccessorAttacher. */
template
<
typename
UserType
>
using
AccessorList
=
std
::
list
<
std
::
pair
<
ArrayPushInput
<
UserType
>
,
std
::
vector
<
ArrayOutput
<
UserType
>
>>
>
;
using
AccessorList
=
std
::
list
<
std
::
pair
<
ArrayPushInput
<
UserType
>
,
HistoryEntry
<
UserType
>
>
>
;
TemplateUserTypeMap
<
AccessorList
>
_accessorListMap
;
/** boost::fusion::map of UserTypes to std::lists containing the names of the
...
...
@@ -127,6 +137,7 @@ namespace ChimeraTK { namespace history {
std
::
list
<
std
::
string
>
_overallVariableList
;
size_t
_historyLength
;
bool
_enbaleTimeStamps
;
friend
struct
AccessorAttacher
;
};
...
...
This diff is collapsed.
Click to expand it.
Modules/src/ServerHistory.cc
+
23
−
7
View file @
ff09c1fe
#include
"ServerHistory.h"
//
#include "
ChimeraTK/TransferElementID.h
"
#include
"
boost/date_time/posix_time/posix_time.hpp
"
namespace
ChimeraTK
{
namespace
history
{
...
...
@@ -90,17 +90,27 @@ namespace ChimeraTK { namespace history {
0
,
""
,
}),
std
::
forward_as_tuple
(
std
::
vector
<
ArrayOutput
<
UserType
>>
{
}));
std
::
forward_as_tuple
(
HistoryEntry
<
UserType
>
{
_enbaleTimeStamps
}));
for
(
size_t
i
=
0
;
i
<
nElements
;
i
++
)
{
if
(
nElements
==
1
)
{
// in case of a scalar history only use the variableName
tmpList
.
back
().
second
.
emplace_back
(
tmpList
.
back
().
second
.
data
.
emplace_back
(
ArrayOutput
<
UserType
>
{
&
groupMap
[
dirName
],
baseName
,
""
,
_historyLength
,
""
,
{
"CS"
,
getName
()}});
if
(
_enbaleTimeStamps
){
tmpList
.
back
().
second
.
timeStamp
.
emplace_back
(
ArrayOutput
<
uint64_t
>
{
&
groupMap
[
dirName
],
baseName
+
"_timeStamps"
,
"Time stamps for entries in the history buffer"
,
_historyLength
,
""
,
{
"CS"
,
getName
()}});
}
}
else
{
// in case of an array history append the index to the variableName
tmpList
.
back
().
second
.
emplace_back
(
ArrayOutput
<
UserType
>
{
tmpList
.
back
().
second
.
data
.
emplace_back
(
ArrayOutput
<
UserType
>
{
&
groupMap
[
dirName
],
baseName
+
"_"
+
std
::
to_string
(
i
),
""
,
_historyLength
,
""
,
{
"CS"
,
getName
()}});
if
(
_enbaleTimeStamps
){
tmpList
.
back
().
second
.
timeStamp
.
emplace_back
(
ArrayOutput
<
uint64_t
>
{
&
groupMap
[
dirName
],
baseName
+
"_"
+
std
::
to_string
(
i
)
+
"_timeStamps"
,
"Time stamps for entries in the history buffer"
,
_historyLength
,
""
,
{
"CS"
,
getName
()}});
}
}
}
nameList
.
push_back
(
variableName
);
...
...
@@ -119,9 +129,15 @@ namespace ChimeraTK { namespace history {
if
(
accessor
->
first
.
getId
()
==
_id
)
{
for
(
size_t
i
=
0
;
i
<
accessor
->
first
.
getNElements
();
i
++
)
{
std
::
rotate
(
accessor
->
second
.
at
(
i
).
begin
(),
accessor
->
second
.
at
(
i
).
begin
()
+
1
,
accessor
->
second
.
at
(
i
).
end
());
*
(
accessor
->
second
.
at
(
i
).
end
()
-
1
)
=
accessor
->
first
[
i
];
accessor
->
second
.
at
(
i
).
write
();
accessor
->
second
.
data
.
at
(
i
).
begin
(),
accessor
->
second
.
data
.
at
(
i
).
begin
()
+
1
,
accessor
->
second
.
data
.
at
(
i
).
end
());
*
(
accessor
->
second
.
data
.
at
(
i
).
end
()
-
1
)
=
accessor
->
first
[
i
];
accessor
->
second
.
data
.
at
(
i
).
write
();
if
(
accessor
->
second
.
withTimeStamps
){
std
::
rotate
(
accessor
->
second
.
timeStamp
.
at
(
i
).
begin
(),
accessor
->
second
.
timeStamp
.
at
(
i
).
begin
()
+
1
,
accessor
->
second
.
timeStamp
.
at
(
i
).
end
());
*
(
accessor
->
second
.
timeStamp
.
at
(
i
).
end
()
-
1
)
=
boost
::
posix_time
::
to_time_t
(
boost
::
posix_time
::
second_clock
::
local_time
());
accessor
->
second
.
timeStamp
.
at
(
i
).
write
();
}
}
}
}
...
...
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