Commit 5ccd3a08 authored by neverlord's avatar neverlord

benchmark update

parent ad3754fa
#!/bin/bash
IFLAGS="-I../../Theron/Include/"
LFLAGS="-L../../Theron/Lib -ltheron -lboost_thread"
FLAGS="-O2 -fno-strict-aliasing -DNDEBUG -DTHERON_MAX_ACTORS=530000"
for i in theron_*.cpp ; do
out_file=$(echo $i | sed 's/\(.*\)\..*/\1/')
echo "g++ -std=c++0x $i -o $out_file $FLAGS $LFLAGS $IFLAGS"
g++ -std=c++0x $i -o $out_file $FLAGS $LFLAGS $IFLAGS
done
FLAGS="-O3 -fno-strict-aliasing -DNDEBUG -DTHERON_MAX_ACTORS=530000"
if [[ $# -eq 0 ]] ; then
for i in theron_*.cpp ; do
out_file=$(echo $i | sed 's/\(.*\)\..*/\1/')
echo "g++ -std=c++0x $i -o $out_file $FLAGS $LFLAGS $IFLAGS"
g++ -std=c++0x $i -o $out_file $FLAGS $LFLAGS $IFLAGS
done
elif [[ $# -eq 1 ]] ; then
echo "g++ -std=c++0x theron_$1.cpp -o theron_$1 $FLAGS $LFLAGS $IFLAGS"
g++ -std=c++0x theron_$1.cpp -o theron_$1 $FLAGS $LFLAGS $IFLAGS
fi
......@@ -59,7 +59,7 @@ int main(int argc, char** argv)
{
if (argc != 4)
{
return 1;
usage();
}
enum { invalid_impl, push_impl, send_impl } impl = invalid_impl;
if (strcmp(argv[1], "push") == 0) impl = push_impl;
......
......@@ -55,7 +55,7 @@ struct chain_link : Actor
{
Send(msg, next);
}
typedef struct { Address next } Parameters;
typedef struct { Address next; } Parameters;
chain_link(Parameters const& p) : next(p.next)
{
RegisterHandler(this, &chain_link::handle_token);
......@@ -68,25 +68,25 @@ struct master : Actor
int iteration;
int max_iterations;
Address next;
ActorRef worker;
ActorRef w;
int ring_size;
int initial_token_value;
std::vector<ActorRef> m_children;
void new_ring()
{
m_children.clear();
worker.Push(calc_msg{s_task_n}, GetAddress());
w.Push(calc_msg{s_task_n}, GetAddress());
next = GetAddress();
for (int i = 1; i < ring_size; ++i)
{
m_children.push_back(GetFramework().CreateActor<chain_link>(chain_link::Parameters(next)));
m_children.push_back(GetFramework().CreateActor<chain_link>(chain_link::Parameters{next}));
next = m_children.back().GetAddress();
}
Send(token_msg{initial_token_value}, next);
}
void handle_init(init_msg const& msg, Address)
{
worker = GetFramework().CreateActor<worker>();
w = GetFramework().CreateActor<worker>();
iteration = 0;
ring_size = msg.ring_size;
initial_token_value = msg.token_value;
......@@ -103,7 +103,7 @@ struct master : Actor
}
else
{
worker.Push(master_done(), GetAddress());
w.Push(master_done(), GetAddress());
}
}
else
......@@ -114,15 +114,21 @@ struct master : Actor
void handle_worker_done(worker_done const&, Address)
{
Send(master_done(), mc);
w = ActorRef::Null();
}
typedef struct { Address mc; } Parameters;
master(Parameters const& p) mc(p.mc), iteration(0) { }
master(Parameters const& p) : mc(p.mc), iteration(0)
{
RegisterHandler(this, &master::handle_init);
RegisterHandler(this, &master::handle_token);
RegisterHandler(this, &master::handle_worker_done);
}
};
void usage()
{
cout << "usage: mailbox_performance "
"_ (num rings) (ring size) "
"'send' (num rings) (ring size) "
"(initial token value) (repetitions)"
<< endl
<< endl;
......@@ -132,6 +138,7 @@ void usage()
int main(int argc, char** argv)
{
if (argc != 6) usage();
if (strcmp("send", argv[1]) != 0) usage();
int num_rings = rd<int>(argv[2]);
int ring_size = rd<int>(argv[3]);
int inital_token_value = rd<int>(argv[4]);
......
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