]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
* csyn: start up N synthetic clients, not just 1
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 15 Mar 2007 23:12:32 +0000 (23:12 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 15 Mar 2007 23:12:32 +0000 (23:12 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1246 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/csyn.cc

index b5e4892cb9a6e602c3f33f1a87952b8713cb5c71..0f95ee56b26020c8f8823ec156eaa7c99b0a1062 100644 (file)
@@ -53,31 +53,44 @@ int main(int argc, char **argv, char *envp[]) {
   // start up network
   rank.start_rank();
 
-  // start client
-  Client *client = new Client(rank.register_entity(MSG_ADDR_CLIENT_NEW), &monmap);
-  client->init();
+  list<Client*> clients;
+  list<SyntheticClient*> synclients;
+
+  cout << "mounting and starting " << g_conf.num_client << " syn client(s)" << endl;
+  for (int i=0; i<g_conf.num_client; i++) {
+    // start client
+    Client *client = new Client(rank.register_entity(MSG_ADDR_CLIENT_NEW), &monmap);
+    client->init();
     
-  // start syntheticclient
-  SyntheticClient *syn = new SyntheticClient(client);
+    // start syntheticclient
+    SyntheticClient *syn = new SyntheticClient(client);
 
-  // start up fuse
-  // use my argc, argv (make sure you pass a mount point!)
-  cout << "mounting" << endl;
-  client->mount();
-  
-  cout << "starting syn client" << endl;
-  syn->start_thread();
+    client->mount();
+    
+    syn->start_thread();
+
+    clients.push_back(client);
+    synclients.push_back(syn);
+  }
+
+  cout << "waiting for client(s) to finish" << endl;
+  while (!clients.empty()) {
+    Client *client = clients.front();
+    SyntheticClient *syn = synclients.front();
+    clients.pop_front();
+    synclients.pop_front();
+    
+    // wait
+    syn->join_thread();
 
-  // wait
-  syn->join_thread();
+    // unmount
+    client->unmount();
+    client->shutdown();
 
-  // unmount
-  client->unmount();
-  cout << "unmounted" << endl;
-  client->shutdown();
-  
-  delete client;
-  
+    delete syn;
+    delete client;
+  }
+    
   // wait for messenger to finish
   rank.wait();