Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
448117a4
Commit
448117a4
authored
Sep 26, 2017
by
Sebastian Woelke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add debug feature, count steals and sched events
parent
fa5f795c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
3 deletions
+48
-3
libcaf_core/caf/execution_unit.hpp
libcaf_core/caf/execution_unit.hpp
+8
-0
libcaf_core/caf/policy/locality_guided_scheduling.hpp
libcaf_core/caf/policy/locality_guided_scheduling.hpp
+6
-1
libcaf_core/caf/policy/work_sharing.hpp
libcaf_core/caf/policy/work_sharing.hpp
+2
-0
libcaf_core/caf/policy/work_stealing.hpp
libcaf_core/caf/policy/work_stealing.hpp
+6
-1
libcaf_core/caf/scheduler/coordinator.hpp
libcaf_core/caf/scheduler/coordinator.hpp
+13
-0
libcaf_core/caf/scheduler/worker.hpp
libcaf_core/caf/scheduler/worker.hpp
+12
-1
libcaf_core/src/scheduled_actor.cpp
libcaf_core/src/scheduled_actor.cpp
+1
-0
No files found.
libcaf_core/caf/execution_unit.hpp
View file @
448117a4
...
...
@@ -66,6 +66,14 @@ public:
return
"execution unit has no description yet"
;
}
virtual
size_t
num_of_scheduling_events
()
const
{
return
0
;
}
virtual
void
add_scheduling_event
()
{
// nop
}
protected:
actor_system
*
system_
;
proxy_registry
*
proxies_
;
...
...
libcaf_core/caf/policy/locality_guided_scheduling.hpp
View file @
448117a4
...
...
@@ -361,6 +361,8 @@ public:
atom_value
actor_pinning_entity
;
atom_value
wws_start_entity
;
size_t
start_steal_group_idx
;
size_t
num_of_steal_attempts
=
0
;
size_t
num_of_successfully_steals
=
0
;
};
/// Create x workers.
...
...
@@ -502,9 +504,12 @@ public:
// try to steal every X poll attempts
if
((
i
%
strat
.
steal_interval
)
==
0
)
{
job
=
try_steal
(
self
,
steal_group_idx
,
steal_cnt
);
if
(
job
)
++
d
(
self
).
num_of_steal_attempts
;
if
(
job
)
{
++
d
(
self
).
num_of_successfully_steals
;
return
job
;
}
}
if
(
strat
.
sleep_duration
.
count
()
>
0
)
std
::
this_thread
::
sleep_for
(
strat
.
sleep_duration
);
}
...
...
libcaf_core/caf/policy/work_sharing.hpp
View file @
448117a4
...
...
@@ -57,6 +57,8 @@ public:
explicit
worker_data
(
scheduler
::
abstract_coordinator
*
)
{
// nop
}
size_t
num_of_steal_attempts
=
0
;
size_t
num_of_successfully_steals
=
0
;
};
// Create x workers.
...
...
libcaf_core/caf/policy/work_stealing.hpp
View file @
448117a4
...
...
@@ -102,6 +102,8 @@ public:
std
::
default_random_engine
rengine
;
std
::
uniform_int_distribution
<
size_t
>
uniform
;
std
::
vector
<
poll_strategy
>
strategies
;
size_t
num_of_steal_attempts
=
0
;
size_t
num_of_successfully_steals
=
0
;
};
// Create x workers.
...
...
@@ -179,9 +181,12 @@ public:
// try to steal every X poll attempts
if
((
i
%
strat
.
steal_interval
)
==
0
)
{
job
=
try_steal
(
self
);
if
(
job
)
++
d
(
self
).
num_of_steal_attempts
;
if
(
job
)
{
++
d
(
self
).
num_of_successfully_steals
;
return
job
;
}
}
if
(
strat
.
sleep_duration
.
count
()
>
0
)
std
::
this_thread
::
sleep_for
(
strat
.
sleep_duration
);
}
...
...
libcaf_core/caf/scheduler/coordinator.hpp
View file @
448117a4
...
...
@@ -121,6 +121,19 @@ protected:
for
(
auto
&
w
:
data_
.
workers
)
{
w
->
get_thread
().
join
();
}
// accumululate statistics
size_t
sum_num_of_steal_attempts
=
0
;
size_t
sum_num_of_successfully_steals
=
0
;
size_t
sum_num_of_scheduling_events
=
0
;
for
(
auto
&
w
:
data_
.
workers
)
{
sum_num_of_steal_attempts
+=
w
->
data
().
num_of_steal_attempts
;
sum_num_of_successfully_steals
+=
w
->
data
().
num_of_successfully_steals
;
sum_num_of_scheduling_events
+=
w
->
num_of_scheduling_events
();
}
std
::
cerr
<<
sum_num_of_scheduling_events
<<
", "
<<
sum_num_of_steal_attempts
<<
", "
<<
sum_num_of_successfully_steals
<<
std
::
endl
;
// run cleanup code for each resumable
auto
f
=
&
abstract_coordinator
::
cleanup_and_release
;
for
(
auto
&
w
:
data_
.
workers
)
...
...
libcaf_core/caf/scheduler/worker.hpp
View file @
448117a4
...
...
@@ -48,7 +48,8 @@ public:
,
id_
(
worker_id
)
,
parent_
(
worker_parent
)
,
all_workers_are_neighbors_
(
true
)
,
data_
(
worker_parent
)
{
,
data_
(
worker_parent
)
,
num_of_scheduling_events_
(
0
)
{
// nop
}
...
...
@@ -131,6 +132,14 @@ public:
all_workers_are_neighbors_
=
x
;
}
size_t
num_of_scheduling_events
()
const
override
{
return
num_of_scheduling_events_
;
}
void
add_scheduling_event
()
override
{
++
num_of_scheduling_events_
;
}
private:
void
run
()
{
CAF_SET_LOGGER_SYS
(
&
system
());
...
...
@@ -183,6 +192,8 @@ private:
policy_data
data_
;
// instance of our policy object
Policy
policy_
;
size_t
num_of_scheduling_events_
;
};
}
// namespace scheduler
...
...
libcaf_core/src/scheduled_actor.cpp
View file @
448117a4
...
...
@@ -249,6 +249,7 @@ scheduled_actor::resume(execution_unit* ctx, size_t max_throughput) {
return
resumable
::
awaiting_message
;
}
}
while
(
!
ptr
);
ctx
->
add_scheduling_event
();
switch
(
reactivate
(
*
ptr
))
{
case
activation_result
:
:
terminated
:
return
resume_result
::
done
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment