Commit d4fdf6a7 authored by neverlord's avatar neverlord

benchmark update

parent 7a415741
#!/bin/bash #!/bin/bash
read -r cmd read -r cmd
export JAVA_OPTS="-Xmx4096M" export JAVA_OPTS="-Xmx4096M"
/usr/bin/time -p $cmd 2>&1 #| grep "^real" | grep -o -P "[0-9]*(\.[0-9]*)?" /usr/bin/time -p -f "%e" $cmd 2>&1 #| grep "^real" | grep -o -P "[0-9]*(\.[0-9]*)?"
...@@ -57,7 +57,7 @@ struct fsm_receiver : fsm_actor<fsm_receiver> ...@@ -57,7 +57,7 @@ struct fsm_receiver : fsm_actor<fsm_receiver>
++m_value; ++m_value;
if (m_value == max) if (m_value == max)
{ {
quit(exit_reason::normal); become_void();
} }
} }
); );
......
...@@ -114,8 +114,12 @@ struct fsm_chain_link : fsm_actor<fsm_chain_link> ...@@ -114,8 +114,12 @@ struct fsm_chain_link : fsm_actor<fsm_chain_link>
send(next, atom("token"), v); send(next, atom("token"), v);
if (v == 0) if (v == 0)
{ {
quit(exit_reason::normal); become_void();
} }
},
on(atom("done")) >> [=]()
{
become_void();
} }
); );
} }
...@@ -165,7 +169,8 @@ struct fsm_chain_master : fsm_actor<fsm_chain_master> ...@@ -165,7 +169,8 @@ struct fsm_chain_master : fsm_actor<fsm_chain_master>
exit_reason::user_defined); exit_reason::user_defined);
if (remainig_results == 0) if (remainig_results == 0)
{ {
quit(exit_reason::normal); send(worker, atom("done"));
become_void();
} }
else else
{ {
...@@ -177,7 +182,8 @@ struct fsm_chain_master : fsm_actor<fsm_chain_master> ...@@ -177,7 +182,8 @@ struct fsm_chain_master : fsm_actor<fsm_chain_master>
--remainig_results; --remainig_results;
if (remainig_results == 0) if (remainig_results == 0)
{ {
quit(exit_reason::normal); send(worker, atom("done"));
become_void();
} }
} }
); );
...@@ -203,30 +209,38 @@ void tst(); ...@@ -203,30 +209,38 @@ void tst();
void chain_link(actor_ptr next) void chain_link(actor_ptr next)
{ {
receive_loop bool done = false;
do_receive
( (
on<atom("token"), int>() >> [&](int v) on<atom("token"), int>() >> [&](int v)
{ {
send(next, atom("token"), v); send(next, atom("token"), v);
if (v == 0) if (v == 0)
{ {
quit(exit_reason::normal); done = true;
} }
} }
); )
.until([&]() { return done == true; });
} }
void chain_master() void chain_master()
{ {
auto worker = spawn([]() auto worker = spawn([]()
{ {
receive_loop bool done = false;
do_receive
( (
on<atom("calc"), uint64_t>() >> [=](uint64_t what) on<atom("calc"), uint64_t>() >> [](uint64_t what)
{ {
reply(atom("result"), factorize(what)); reply(atom("result"), factorize(what));
},
on(atom("done")) >> [&]()
{
done = true;
} }
); )
.until([&]() { return done == true; });
}); });
actor_ptr next; actor_ptr next;
int remaining_results = 0; int remaining_results = 0;
...@@ -273,7 +287,7 @@ void chain_master() ...@@ -273,7 +287,7 @@ void chain_master()
&& remaining_results == 0; }); && remaining_results == 0; });
} }
); );
send(worker, atom(":Exit"), exit_reason::user_defined); send(worker, atom("done"));
} }
template<typename F> template<typename F>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment