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
47f9a907
Commit
47f9a907
authored
Nov 25, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compiler issues on GCC/Clang
parent
bd4d2ce3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
tools/caf-vec.cpp
tools/caf-vec.cpp
+19
-20
No files found.
tools/caf-vec.cpp
View file @
47f9a907
...
...
@@ -252,10 +252,10 @@ protected:
struct
node_cmp_t
{
bool
operator
()(
const
entity
&
x
,
const
node_id
&
y
)
const
{
return
x
.
nid
<
y
;
}
;
}
bool
operator
()(
const
node_id
&
x
,
const
entity
&
y
)
const
{
return
x
<
y
.
nid
;
}
;
}
};
constexpr
node_cmp_t
node_cmp
=
node_cmp_t
{};
...
...
@@ -264,10 +264,10 @@ constexpr node_cmp_t node_cmp = node_cmp_t{};
struct
actor_cmp_t
{
bool
operator
()(
const
entity
&
x
,
actor_id
y
)
const
{
return
x
.
aid
<
y
;
}
;
}
bool
operator
()(
actor_id
x
,
const
entity
&
y
)
const
{
return
x
<
y
.
aid
;
}
;
}
};
constexpr
actor_cmp_t
actor_cmp
=
actor_cmp_t
{};
...
...
@@ -336,10 +336,6 @@ const entity* get(const node_range& xs, const thread_id& y) {
const
entity
*
get
(
const
node_range
&
xs
,
actor_id
y
)
{
if
(
y
==
0
)
return
nullptr
;
// only compares actor ID
auto
actor_cmp
=
[](
const
entity
&
lhs
,
actor_id
rhs
)
{
return
lhs
.
aid
<
rhs
;
};
// range [xs.first, xs.second) is sortd by actor ID
using
namespace
std
;
auto
i
=
lower_bound
(
xs
.
begin
(),
xs
.
end
(),
y
,
actor_cmp
);
...
...
@@ -406,12 +402,14 @@ string to_string(se_type x) {
return
tbl
[
static_cast
<
int
>
(
x
)];
}
using
string_map
=
std
::
map
<
string
,
string
>
;
/// An SE-0001 event, see http://actor-framework.github.io/rfcs/
struct
se_event
{
const
entity
*
source
;
vector_timestamp
vstamp
;
se_type
type
;
st
d
::
map
<
string
,
string
>
fields
;
st
ring_map
fields
;
};
string
to_string
(
const
se_event
&
x
)
{
...
...
@@ -456,7 +454,7 @@ bool field_key_compare(const std::pair<const std::string, std::string>& x,
return sec::invalid_argument;
expected
<
se_event
>
parse_event
(
const
enhanced_log_entry
&
x
)
{
se_event
y
{
&
x
.
id
,
x
.
vstamp
,
se_type
::
none
,
{}};
se_event
y
{
&
x
.
id
,
x
.
vstamp
,
se_type
::
none
,
string_map
{}};
std
::
istringstream
in
{
x
.
data
.
message
};
string
type
;
if
(
!
(
in
>>
type
))
...
...
@@ -767,6 +765,8 @@ void second_pass(blocking_actor* self, const group& grp,
}
}
namespace
{
struct
config
:
public
actor_system_config
{
string
output_file
;
bool
include_hidden_actors
=
false
;
...
...
@@ -808,15 +808,16 @@ void caf_main(actor_system& sys, const config& cfg) {
using
file_path
=
string
;
static
constexpr
size_t
irsize
=
sizeof
(
file_path
)
+
sizeof
(
std
::
ifstream
)
+
sizeof
(
first_pass_result
);
using
ifstream_ptr
=
std
::
unique_ptr
<
std
::
ifstream
>
;
struct
intermediate_res
{
file_path
fname
;
std
::
ifstream
fstream
;
ifstream_ptr
fstream
;
first_pass_result
res
;
char
pad
[
irsize
>=
CAF_CACHE_LINE_SIZE
?
1
:
CAF_CACHE_LINE_SIZE
-
irsize
];
intermediate_res
()
=
default
;
intermediate_res
(
intermediate_res
&&
)
=
default
;
intermediate_res
&
operator
=
(
intermediate_res
&&
)
=
default
;
intermediate_res
(
file_path
fp
,
std
::
ifstream
&&
fs
,
first_pass_result
&&
fr
)
intermediate_res
(
file_path
fp
,
ifstream_ptr
fs
,
first_pass_result
&&
fr
)
:
fname
(
std
::
move
(
fp
)),
fstream
(
std
::
move
(
fs
)),
res
(
std
::
move
(
fr
))
{
...
...
@@ -830,13 +831,13 @@ void caf_main(actor_system& sys, const config& cfg) {
auto
&
file
=
cfg
.
args_remainder
.
get_as
<
string
>
(
i
);
auto
ptr
=
&
intermediate_results
[
i
];
ptr
->
fname
=
file
;
ptr
->
fstream
.
open
(
file
);
if
(
!
ptr
->
fstream
)
{
ptr
->
fstream
.
reset
(
new
std
::
ifstream
(
file
)
);
if
(
!
*
ptr
->
fstream
)
{
cerr
<<
"could not open file: "
<<
file
<<
endl
;
continue
;
}
sys
.
spawn
([
ptr
,
vl
](
blocking_actor
*
self
)
{
auto
&
f
=
ptr
->
fstream
;
auto
&
f
=
*
ptr
->
fstream
;
auto
res
=
first_pass
(
self
,
f
,
vl
);
if
(
res
)
{
// rewind stream and push intermediate results
...
...
@@ -869,10 +870,6 @@ void caf_main(actor_system& sys, const config& cfg) {
//"actor" + std::to_string(kvp.first.aid);
else
pretty_name
=
"thread"
+
std
::
to_string
(
++
thread_count
);
/*
pretty_name += '@';
pretty_name += node_as_string;
*/
auto
vid
=
entities
.
size
();
// position in the vector timestamp
entity_names
.
emplace_back
(
pretty_name
);
entities
.
emplace
(
entity
{
kvp
.
first
.
aid
,
kvp
.
first
.
tid
,
ir
.
res
.
this_node
,
...
...
@@ -901,11 +898,13 @@ void caf_main(actor_system& sys, const config& cfg) {
for
(
auto
&
fpr
:
intermediate_results
)
{
sys
.
spawn_in_group
(
grp
,
[
&
](
blocking_actor
*
self
)
{
second_pass
(
self
,
grp
,
entities
,
fpr
.
res
.
this_node
,
entity_names
,
fpr
.
fstream
,
out
,
out_mtx
,
!
cfg
.
include_hidden_actors
,
vl
);
*
fpr
.
fstream
,
out
,
out_mtx
,
!
cfg
.
include_hidden_actors
,
vl
);
});
}
sys
.
await_all_actors_done
();
}
}
// namespace <anonymous>
CAF_MAIN
()
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