Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
tci-gateway-module
Grpc
Commits
d6936b6b
Commit
d6936b6b
authored
8 years ago
by
David Garcia Quintas
Browse files
Options
Downloads
Patches
Plain Diff
PR comments
parent
a05909fa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/cpp/qps/json_run_localhost.cc
+13
-13
13 additions, 13 deletions
test/cpp/qps/json_run_localhost.cc
with
13 additions
and
13 deletions
test/cpp/qps/json_run_localhost.cc
+
13
−
13
View file @
d6936b6b
...
@@ -47,8 +47,9 @@
...
@@ -47,8 +47,9 @@
using
grpc
::
SubProcess
;
using
grpc
::
SubProcess
;
typedef
std
::
unique_ptr
<
SubProcess
>
SubProcessPtr
;
typedef
std
::
unique_ptr
<
SubProcess
>
SubProcessPtr
;
std
::
vector
<
SubProcessPtr
>
g_workers
;
SubProcessPtr
g_driver
;
SubProcessPtr
g_driver
;
constexpr
auto
kNumWorkers
=
2
;
std
::
vector
<
SubProcessPtr
>
g_workers
(
2
);
template
<
class
T
>
template
<
class
T
>
std
::
string
as_string
(
const
T
&
val
)
{
std
::
string
as_string
(
const
T
&
val
)
{
...
@@ -58,10 +59,11 @@ std::string as_string(const T& val) {
...
@@ -58,10 +59,11 @@ std::string as_string(const T& val) {
}
}
static
void
sighandler
(
int
sig
)
{
static
void
sighandler
(
int
sig
)
{
const
int
errno_saved
=
errno
;
g_driver
->
Interrupt
();
g_driver
->
Interrupt
();
for
(
auto
it
=
g_workers
.
begin
();
it
!=
g_workers
.
end
();
++
it
)
{
for
(
const
auto
&
worker
:
g_workers
)
(
*
it
)
->
Interrupt
();
if
(
worker
)
worker
->
Interrupt
();
}
errno
=
errno_saved
;
}
}
static
void
register_sighandler
()
{
static
void
register_sighandler
()
{
...
@@ -82,11 +84,11 @@ int main(int argc, char** argv) {
...
@@ -82,11 +84,11 @@ int main(int argc, char** argv) {
std
::
ostringstream
env
;
std
::
ostringstream
env
;
bool
first
=
true
;
bool
first
=
true
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
for
(
int
i
=
0
;
i
<
kNumWorkers
;
i
++
)
{
auto
port
=
grpc_pick_unused_port_or_die
();
const
auto
port
=
grpc_pick_unused_port_or_die
();
std
::
vector
<
std
::
string
>
args
=
{
bin_dir
+
"/qps_worker"
,
"-driver_port"
,
std
::
vector
<
std
::
string
>
args
=
{
bin_dir
+
"/qps_worker"
,
"-driver_port"
,
as_string
(
port
)};
as_string
(
port
)};
g_workers
.
emplace_back
(
new
SubProcess
(
args
));
g_workers
[
i
].
reset
(
new
SubProcess
(
args
));
if
(
!
first
)
env
<<
","
;
if
(
!
first
)
env
<<
","
;
env
<<
"localhost:"
<<
port
;
env
<<
"localhost:"
<<
port
;
first
=
false
;
first
=
false
;
...
@@ -100,11 +102,9 @@ int main(int argc, char** argv) {
...
@@ -100,11 +102,9 @@ int main(int argc, char** argv) {
g_driver
.
reset
(
new
SubProcess
(
args
));
g_driver
.
reset
(
new
SubProcess
(
args
));
const
int
driver_join_status
=
g_driver
->
Join
();
const
int
driver_join_status
=
g_driver
->
Join
();
for
(
auto
it
=
g_workers
.
begin
();
it
!=
g_workers
.
end
();
++
it
)
{
for
(
const
auto
&
worker
:
g_workers
)
(
*
it
)
->
Interrupt
();
if
(
worker
)
worker
->
Interrupt
();
}
for
(
const
auto
&
worker
:
g_workers
)
for
(
auto
it
=
g_workers
.
begin
();
it
!=
g_workers
.
end
();
++
it
)
{
if
(
worker
)
worker
->
Join
();
(
*
it
)
->
Join
();
}
GPR_ASSERT
(
driver_join_status
==
0
);
GPR_ASSERT
(
driver_join_status
==
0
);
}
}
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