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
63b28447
Commit
63b28447
authored
9 years ago
by
Vijay Pai
Browse files
Options
Downloads
Patches
Plain Diff
Remove the command-line flags
parent
490e5023
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/end2end/thread_stress_test.cc
+10
-19
10 additions, 19 deletions
test/cpp/end2end/thread_stress_test.cc
with
10 additions
and
19 deletions
test/cpp/end2end/thread_stress_test.cc
+
10
−
19
View file @
63b28447
...
...
@@ -34,7 +34,6 @@
#include
<mutex>
#include
<thread>
#include
<gflags/gflags.h>
#include
<grpc++/channel.h>
#include
<grpc++/client_context.h>
#include
<grpc++/create_channel.h>
...
...
@@ -56,15 +55,8 @@ using grpc::testing::EchoRequest;
using
grpc
::
testing
::
EchoResponse
;
using
std
::
chrono
::
system_clock
;
// In some distros, gflags is in the namespace google, and in some others,
// in gflags. This hack is enabling us to find both.
namespace
google
{}
namespace
gflags
{}
using
namespace
google
;
using
namespace
gflags
;
DEFINE_int32
(
num_threads
,
100
,
"Number of threads"
);
DEFINE_int32
(
num_rpcs
,
1000
,
"Number of RPCs per thread"
);
const
int
kNumThreads
=
100
;
// Number of threads
const
int
kNumRpcs
=
1000
;
// Number of RPCs per thread
namespace
grpc
{
namespace
testing
{
...
...
@@ -239,11 +231,11 @@ static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs) {
TEST_F
(
End2endTest
,
ThreadStress
)
{
common_
.
ResetStub
();
std
::
vector
<
std
::
thread
*>
threads
;
for
(
int
i
=
0
;
i
<
FLAGS_num_t
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
kNumT
hreads
;
++
i
)
{
threads
.
push_back
(
new
std
::
thread
(
SendRpc
,
common_
.
GetStub
(),
FLAGS_num_r
pcs
));
new
std
::
thread
(
SendRpc
,
common_
.
GetStub
(),
kNumR
pcs
));
}
for
(
int
i
=
0
;
i
<
FLAGS_num_t
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
kNumT
hreads
;
++
i
)
{
threads
[
i
]
->
join
();
delete
threads
[
i
];
}
...
...
@@ -324,22 +316,22 @@ class AsyncClientEnd2endTest : public ::testing::Test {
TEST_F
(
AsyncClientEnd2endTest
,
ThreadStress
)
{
common_
.
ResetStub
();
std
::
vector
<
std
::
thread
*>
send_threads
,
completion_threads
;
for
(
int
i
=
0
;
i
<
FLAGS_num_t
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
kNumT
hreads
;
++
i
)
{
completion_threads
.
push_back
(
new
std
::
thread
(
&
AsyncClientEnd2endTest_ThreadStress_Test
::
AsyncCompleteRpc
,
this
));
}
for
(
int
i
=
0
;
i
<
FLAGS_num_t
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
kNumT
hreads
;
++
i
)
{
send_threads
.
push_back
(
new
std
::
thread
(
&
AsyncClientEnd2endTest_ThreadStress_Test
::
AsyncSendRpc
,
this
,
FLAGS_num_r
pcs
));
this
,
kNumR
pcs
));
}
for
(
int
i
=
0
;
i
<
FLAGS_num_t
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
kNumT
hreads
;
++
i
)
{
send_threads
[
i
]
->
join
();
delete
send_threads
[
i
];
}
Wait
();
for
(
int
i
=
0
;
i
<
FLAGS_num_t
hreads
;
++
i
)
{
for
(
int
i
=
0
;
i
<
kNumT
hreads
;
++
i
)
{
completion_threads
[
i
]
->
join
();
delete
completion_threads
[
i
];
}
...
...
@@ -349,7 +341,6 @@ TEST_F(AsyncClientEnd2endTest, ThreadStress) {
}
// namespace grpc
int
main
(
int
argc
,
char
**
argv
)
{
ParseCommandLineFlags
(
&
argc
,
&
argv
,
true
);
grpc_test_init
(
argc
,
argv
);
::
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
...
...
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