Skip to content
Snippets Groups Projects
Commit 8ffe8ca1 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

test connection speeds

parent bb0fbc4d
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,9 @@ int GmshDaemon(std::string socket)
// read large data file,
// initialize mpi job,
// then wait for commands to execute:
bool stop = false;
while(1){
if(stop) break;
// wait at most 1 second for data
if(!client.Select(1, 0)){
int type, length;
......@@ -33,23 +35,34 @@ int GmshDaemon(std::string socket)
tmp << "Hello! I've received msg type=" << type << " len=" << length
<< " str=" << msg;
client.Info(tmp.str().c_str());
if(type == GmshSocket::GMSH_STOP){
client.Info("Stopping connection!");
delete [] msg;
switch(type){
case GmshSocket::GMSH_STOP:
{
client.Info("Stopping connection!");
stop = true;
}
break;
}
else{
std::ostringstream v;
v << "View \"test\" {\n";
for(int i= 0; i < 100; i++){
for(int j= 0; j < 100; j++){
v << "SQ("<<i<<","<<j<<",0, "<<i+1<<","<<j<<",0, "
<<i+1<<","<<j+1<<",0, "<<i<<","<<j+1<<",0){"
<<i+j<<","<<i+j<<","<<i+j<<","<<i+j<<"};\n";
case GmshSocket::GMSH_SPEED_TEST:
{
std::string huge(500000000, 'a');
client.SpeedTest(huge.c_str());
}
break;
default:
{
std::ostringstream v;
v << "View \"test\" {\n";
for(int i = 0; i < 100; i++){
for(int j = 0; j < 100; j++){
v << "SQ("<<i<<","<<j<<",0, "<<i+1<<","<<j<<",0, "
<<i+1<<","<<j+1<<",0, "<<i<<","<<j+1<<",0){"
<<i+j<<","<<i+j<<","<<i+j<<","<<i+j<<"};\n";
}
}
v << "};BoundingBox;\n";
client.ParseString(v.str().c_str());
}
v << "};BoundingBox;\n";
client.ParseString(v.str().c_str());
break;
}
}
delete [] msg;
......
......@@ -156,7 +156,7 @@ static void file_remote_cb(Fl_Widget *w, void *data)
Msg::Error("A server is already running");
}
else{
GmshRemote::get(99)->name = "Gmsh server";
GmshRemote::get(99)->name = "Remote";
GmshRemote::get(99)->executable = "./gmsh";
GmshRemote::get(99)->socketSwitch = "-socket %s";
GmshRemote::get(99)->run("");
......@@ -166,7 +166,7 @@ static void file_remote_cb(Fl_Widget *w, void *data)
if(GmshRemote::get(99)->getServer()){
Msg::Info("Stopping remote Gmsh server");
GmshRemote::get(99)->getServer()->SendString
(GmshSocket::GMSH_STOP, "DISCONNECTING!");
(GmshSocket::GMSH_STOP, "Disconnect!");
}
else{
Msg::Error("Cannot stop remote Gmsh: server not running");
......@@ -175,7 +175,8 @@ static void file_remote_cb(Fl_Widget *w, void *data)
else if(str == "test"){
if(GmshRemote::get(99)->getServer()){
Msg::Info("Testing remote Gmsh server");
GmshRemote::get(99)->getServer()->SendString(9999, "GENERATE A VIEW!");
GmshRemote::get(99)->getServer()->SendString
(GmshSocket::GMSH_SPEED_TEST, "Send me a huge amount of data!");
}
else{
Msg::Error("Cannot test remote Gmsh: server not running");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment