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
582c687b
Commit
582c687b
authored
9 years ago
by
vjpai
Browse files
Options
Downloads
Patches
Plain Diff
Remove use of C++11 randomization engines
parent
6284cdb0
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/interarrival.h
+6
-6
6 additions, 6 deletions
test/cpp/qps/interarrival.h
with
6 additions
and
6 deletions
test/cpp/qps/interarrival.h
+
6
−
6
View file @
582c687b
...
@@ -36,7 +36,8 @@
...
@@ -36,7 +36,8 @@
#include
<chrono>
#include
<chrono>
#include
<cmath>
#include
<cmath>
#include
<random>
#include
<cstdlib>
#include
<vector>
#include
<grpc++/config.h>
#include
<grpc++/config.h>
...
@@ -141,17 +142,16 @@ class ParetoDist GRPC_FINAL : public RandomDist {
...
@@ -141,17 +142,16 @@ class ParetoDist GRPC_FINAL : public RandomDist {
// in an efficient re-entrant way. The random table is built at construction
// in an efficient re-entrant way. The random table is built at construction
// time, and each call must include the thread id of the invoker
// time, and each call must include the thread id of the invoker
typedef
std
::
default_random_engine
qps_random_engine
;
class
InterarrivalTimer
{
class
InterarrivalTimer
{
public:
public:
InterarrivalTimer
()
{}
InterarrivalTimer
()
{}
void
init
(
const
RandomDist
&
r
,
int
threads
,
int
entries
=
1000000
)
{
void
init
(
const
RandomDist
&
r
,
int
threads
,
int
entries
=
1000000
)
{
qps_random_engine
gen
;
std
::
uniform_real_distribution
<
double
>
uniform
(
0.0
,
1.0
);
for
(
int
i
=
0
;
i
<
entries
;
i
++
)
{
for
(
int
i
=
0
;
i
<
entries
;
i
++
)
{
// rand is the only choice that is portable across POSIX and Windows
// and that supports new and old compilers
double
uniform_0_1
=
rand
()
/
RAND_MAX
;
random_table_
.
push_back
(
std
::
chrono
::
nanoseconds
(
random_table_
.
push_back
(
std
::
chrono
::
nanoseconds
(
static_cast
<
int64_t
>
(
1e9
*
r
(
uniform
(
gen
)
))));
static_cast
<
int64_t
>
(
1e9
*
r
(
uniform
_0_1
))));
}
}
// Now set up the thread positions
// Now set up the thread positions
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
...
...
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