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
523a4aa0
Commit
523a4aa0
authored
8 years ago
by
David Garcia Quintas
Browse files
Options
Downloads
Patches
Plain Diff
PR comments
parent
a0a3c411
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
+19
-12
19 additions, 12 deletions
test/cpp/qps/json_run_localhost.cc
with
19 additions
and
12 deletions
test/cpp/qps/json_run_localhost.cc
+
19
−
12
View file @
523a4aa0
...
...
@@ -46,10 +46,11 @@
#include
"test/cpp/util/subprocess.h"
using
grpc
::
SubProcess
;
typedef
std
::
unique_ptr
<
SubProcess
>
SubProcessPtr
;
SubProcessPtr
g_driver
;
constexpr
auto
kNumWorkers
=
2
;
std
::
vector
<
SubProcessPtr
>
g_workers
(
2
);
static
SubProcess
*
g_driver
;
static
SubProcess
*
g_workers
[
kNumWorkers
];
template
<
class
T
>
std
::
string
as_string
(
const
T
&
val
)
{
...
...
@@ -61,8 +62,9 @@ std::string as_string(const T& val) {
static
void
sighandler
(
int
sig
)
{
const
int
errno_saved
=
errno
;
g_driver
->
Interrupt
();
for
(
const
auto
&
worker
:
g_workers
)
if
(
worker
)
worker
->
Interrupt
();
for
(
int
i
=
0
;
i
<
kNumWorkers
;
++
i
)
{
if
(
g_workers
[
i
])
g_workers
[
i
]
->
Interrupt
();
}
errno
=
errno_saved
;
}
...
...
@@ -100,7 +102,7 @@ int main(int argc, char** argv) {
const
auto
port
=
grpc_pick_unused_port_or_die
();
std
::
vector
<
std
::
string
>
args
=
{
bin_dir
+
"/qps_worker"
,
"-driver_port"
,
as_string
(
port
)};
g_workers
[
i
]
.
reset
(
new
SubProcess
(
args
)
)
;
g_workers
[
i
]
=
new
SubProcess
(
args
);
if
(
!
first
)
env
<<
","
;
env
<<
"localhost:"
<<
port
;
first
=
false
;
...
...
@@ -112,20 +114,25 @@ int main(int argc, char** argv) {
args
.
push_back
(
argv
[
i
]);
}
g_driver
.
reset
(
new
SubProcess
(
args
)
)
;
g_driver
=
new
SubProcess
(
args
);
const
int
driver_join_status
=
g_driver
->
Join
();
if
(
driver_join_status
!=
0
)
{
LogStatus
(
driver_join_status
,
"driver"
);
}
for
(
const
auto
&
worker
:
g_w
orkers
)
{
if
(
worker
)
worker
->
Interrupt
();
for
(
int
i
=
0
;
i
<
kNumW
orkers
;
++
i
)
{
if
(
g_
worker
s
[
i
])
g_
worker
s
[
i
]
->
Interrupt
();
}
for
(
const
auto
&
worker
:
g_workers
)
{
if
(
worker
)
{
const
int
worker_status
=
worker
->
Join
();
for
(
int
i
=
0
;
i
<
kNumWorkers
;
++
i
)
{
if
(
g_workers
[
i
])
{
const
int
worker_status
=
g_workers
[
i
]
->
Join
();
if
(
worker_status
!=
0
)
{
LogStatus
(
worker_status
,
"worker"
);
}
}
}
delete
g_driver
;
for
(
int
i
=
0
;
i
<
kNumWorkers
;
++
i
)
delete
g_workers
[
i
];
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