Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
asapo
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
Terraform modules
Analyze
Contributor 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
Joao Alvim Oliveira Dias De Almeida
asapo
Commits
f7536a1d
Commit
f7536a1d
authored
4 years ago
by
Carsten Patzke
Browse files
Options
Downloads
Patches
Plain Diff
Fixed windows build
parent
66b9f2db
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/consumer/getnext_broker/getnext_broker.cpp
+10
-9
10 additions, 9 deletions
examples/consumer/getnext_broker/getnext_broker.cpp
with
10 additions
and
9 deletions
examples/consumer/getnext_broker/getnext_broker.cpp
+
10
−
9
View file @
f7536a1d
...
...
@@ -46,7 +46,7 @@ struct Args {
class
LatchedTimer
{
private:
volatile
int
count_
;
std
::
chrono
::
system
_clock
::
time_point
start_time_
=
std
::
chrono
::
system
_clock
::
time_point
::
max
();
std
::
chrono
::
high_resolution
_clock
::
time_point
start_time_
=
std
::
chrono
::
high_resolution
_clock
::
time_point
::
max
();
std
::
mutex
mutex
;
std
::
condition_variable
waiter
;
public:
...
...
@@ -60,7 +60,8 @@ public:
count_
--
;
if
(
0
==
count_
)
{
waiter
.
notify_all
();
start_time_
=
std
::
chrono
::
high_resolution_clock
::
now
();
const
std
::
chrono
::
high_resolution_clock
::
time_point
now
=
std
::
chrono
::
high_resolution_clock
::
now
();
start_time_
=
now
;
}
else
{
while
(
count_
>
0
)
{
waiter
.
wait
(
local_lock
);
...
...
@@ -69,10 +70,10 @@ public:
}
bool
was_triggered
()
const
{
return
start_time
()
!=
std
::
chrono
::
system
_clock
::
time_point
::
max
();
return
start_time
()
!=
std
::
chrono
::
high_resolution
_clock
::
time_point
::
max
();
}
std
::
chrono
::
system
_clock
::
time_point
start_time
()
const
{
std
::
chrono
::
high_resolution
_clock
::
time_point
start_time
()
const
{
return
start_time_
;
};
};
...
...
@@ -97,7 +98,7 @@ StartThreads(const Args& params, std::vector<int>* nfiles, std::vector<int>* err
asapo
::
FileInfo
fi
;
Error
err
;
auto
broker
=
asapo
::
DataBrokerFactory
::
CreateServerBroker
(
params
.
server
,
params
.
file_path
,
true
,
asapo
::
SourceCredentials
{
params
.
beamtime_id
,
""
,
params
.
stream
,
params
.
token
},
&
err
);
asapo
::
SourceCredentials
{
params
.
beamtime_id
,
""
,
params
.
stream
,
params
.
token
},
&
err
);
if
(
err
)
{
std
::
cout
<<
"Error CreateServerBroker: "
<<
err
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
...
...
@@ -179,7 +180,7 @@ StartThreads(const Args& params, std::vector<int>* nfiles, std::vector<int>* err
int
ReadAllData
(
const
Args
&
params
,
uint64_t
*
duration_ms
,
uint64_t
*
duration_without_first_ms
,
int
*
nerrors
,
int
*
nbuf
,
int
*
nfiles_total
,
asapo
::
NetworkConnectionType
*
connection_type
)
{
asapo
::
FileInfo
fi
;
s
ystem_clock
::
time_point
t1
=
system
_clock
::
now
();
s
td
::
chrono
::
high_resolution_clock
::
time_point
t1
=
std
::
chrono
::
high_resolution
_clock
::
now
();
std
::
vector
<
int
>
nfiles
(
params
.
nthreads
,
0
);
std
::
vector
<
int
>
errors
(
params
.
nthreads
,
0
);
...
...
@@ -193,7 +194,7 @@ int ReadAllData(const Args& params, uint64_t* duration_ms, uint64_t* duration_wi
&
latched_timer
);
WaitThreads
(
&
threads
);
s
ystem_clock
::
time_point
t2
=
system
_clock
::
now
();
s
td
::
chrono
::
high_resolution_clock
::
time_point
t2
=
std
::
chrono
::
high_resolution
_clock
::
now
();
auto
duration_read
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
t2
-
t1
);
*
duration_ms
=
duration_read
.
count
();
if
(
latched_timer
.
was_triggered
())
{
...
...
@@ -228,7 +229,7 @@ int ReadAllData(const Args& params, uint64_t* duration_ms, uint64_t* duration_wi
ConnectionTypeToString
(
connection_types
[
i
])
<<
"' but thread["
<<
firstThreadThatActuallyProcessedData
<<
"](processed "
<<
nfiles
[
firstThreadThatActuallyProcessedData
]
<<
" files) is '"
<<
ConnectionTypeToString
(
*
connection_type
)
<<
"'"
<<
std
::
endl
;
*
connection_type
)
<<
"'"
<<
std
::
endl
;
}
}
}
...
...
@@ -261,7 +262,7 @@ int main(int argc, char* argv[]) {
params
.
datasets
=
false
;
if
(
argc
!=
8
&&
argc
!=
9
)
{
std
::
cout
<<
"Usage: "
+
std
::
string
{
argv
[
0
]}
+
" <server> <files_path> <run_name> <nthreads> <token> <timeout ms> <metaonly> [use datasets]"
+
" <server> <files_path> <run_name> <nthreads> <token> <timeout ms> <metaonly> [use datasets]"
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
...
...
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