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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
289bc215
Commit
289bc215
authored
Mar 17, 2017
by
Yuchen Zeng
Committed by
GitHub
Mar 17, 2017
Browse files
Options
Downloads
Plain Diff
Merge pull request #9995 from y-zeng/cpu_test
Avoid repetitive division calculations
parents
d9efa4a5
f0d6b886
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/core/support/cpu_test.c
+5
-2
5 additions, 2 deletions
test/core/support/cpu_test.c
with
5 additions
and
2 deletions
test/core/support/cpu_test.c
+
5
−
2
View file @
289bc215
...
@@ -81,9 +81,12 @@ static void worker_thread(void *arg) {
...
@@ -81,9 +81,12 @@ static void worker_thread(void *arg) {
uint32_t
cpu
;
uint32_t
cpu
;
unsigned
r
=
12345678
;
unsigned
r
=
12345678
;
unsigned
i
,
j
;
unsigned
i
,
j
;
for
(
i
=
0
;
i
<
1000
/
grpc_test_slowdown_factor
();
i
++
)
{
/* Avoid repetitive division calculations */
int64_t
max_i
=
1000
/
grpc_test_slowdown_factor
();
int64_t
max_j
=
1000000
/
grpc_test_slowdown_factor
();
for
(
i
=
0
;
i
<
max_i
;
i
++
)
{
/* run for a bit - just calculate something random. */
/* run for a bit - just calculate something random. */
for
(
j
=
0
;
j
<
1000000
/
grpc_test_slowdown_factor
()
;
j
++
)
{
for
(
j
=
0
;
j
<
max_j
;
j
++
)
{
r
=
(
r
*
17
)
&
((
r
-
i
)
|
(
r
*
i
));
r
=
(
r
*
17
)
&
((
r
-
i
)
|
(
r
*
i
));
}
}
cpu
=
gpr_cpu_current_cpu
();
cpu
=
gpr_cpu_current_cpu
();
...
...
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
sign in
to comment