Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix doxygen comments.
[simgrid.git] / examples / java / io / Node.java
1 /*
2  * 2012. The SimGrid Team. All rights reserved. 
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. 
6  */
7 package io;
8
9 import org.simgrid.msg.File;
10 import org.simgrid.msg.Host;
11 import org.simgrid.msg.HostNotFoundException;
12 import org.simgrid.msg.Msg;
13 import org.simgrid.msg.MsgException;
14 import org.simgrid.msg.Process;
15
16 public class Node extends Process {
17         private static String FILENAME1 = "/home/user/Install/simgrid/doc/simgrid/examples/platforms/g5k.xml";
18         private static String FILENAME2 = "/home/user/Install/simgrid/doc/simgrid/examples/platforms/One_cluster_no_backbone.xml";
19         private static String FILENAME3 = "/home/user/Install/simgrid/doc/simgrid/examples/platforms/g5k_cabinets.xml";
20         private static String FILENAME4 = "/home/user/Install/simgrid/doc/simgrid/examples/platforms/nancy.xml";
21                         
22         protected int number;
23                 
24         public Node(Host host, int number) throws HostNotFoundException {
25                 super(host, Integer.toString(number), null);
26                 this.number = number;
27         }       
28         public void main(String[] args) throws MsgException {
29                 String mount = "C:";
30                 String filename;
31                 switch (number) {
32                         case 0:
33                                 filename = FILENAME1;
34                         break;
35                         case 1:
36                                 filename = FILENAME2;
37                         break;
38                         case 2:
39                                 filename = FILENAME3;
40                         break;
41                         case 3:
42                                 filename = FILENAME4;
43                         break;
44                         default:
45                                 filename = FILENAME1;
46                 }
47                 Msg.info("Open file " + filename);
48                 File file = new File(mount,filename);
49
50                 long read = file.read(10000000,1);
51                 Msg.info("Having read " + read + " on " + filename);
52                 
53                 long write = file.read(100000,1);
54                 Msg.info("Having write " + write + " on " + filename);
55
56                 read = file.read(10000000,1);
57                 Msg.info("Having read " + read + " on " + filename);    
58         }
59 }