root/trunk/xbps/xbps.py

Revision 1, 19.8 kB (checked in by root, 3 years ago)

initial import

  • Property svn:executable set to
Line 
1 #!/usr/bin/env python
2
3 #GUI front-end for bps
4
5 from gtk import *
6 import GtkExtra
7 import os
8 import string
9 import socket
10
11 #globals
12
13 wins = {}
14 logdirectory = [os.path.expanduser("~/bps-logs")]
15 numprocs=["1","2","4","8","16","32","64"]
16 numproc = ["1"]
17 #interfaces=["Fast Ethernet","Gigabit Ethernet","Myrinet","Giganet","Dolphin SCI","Quadrics"]
18 interfaces=["Fast Ethernet"]
19 pipeinterface=["Fast Ethernet"]
20 perfinterface=["Fast Ethernet"]
21 ts=["A","B","C","S"]
22 testsize=["S"]
23 cm=["gnu","pgi","intel"]
24 compiler=["gnu"]
25 mpis=["lam","mpich","mpipro","dummy"]
26 mpi=["dummy"]
27 machinename=[""]
28 mboardman=[""]
29 mboardmod=[""]
30 memtype=[""]
31 netcon=[""]
32 linux=[""]
33 port1 = [""]
34 port2 = [""]
35 allstatus = [1]
36 status = [FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE]
37 prompting = [TRUE]
38
39 #Event handling and management
40
41 def delete_event(win, event=None):
42         win.hide()
43         return TRUE
44
45 def do_exit(button):
46         mainquit()
47
48 #Message display handling
49
50 def display_info(_menuitem):
51         GtkExtra.message_box("BPS Benchmark Descriptions",
52         "Bonnie++ - Hardware performance\nStream - Memory bandwith\nNetPerf - Simple UDD and TCP communication testing for fixed packet size\nNetPipe - Measures varying TCP packet size performance\nNAS Parallel Benchmark - Eight parallel benches\nUnixbench - General Unix benchmarking"
53         ,("OK",))
54
55 def display_about(_menuitem):
56         GtkExtra.message_box("About BPS",
57         "Paralogic Beowulf Performance Suite\nPortions (c) 2002 Paralogic, Inc.\nwww.plogic.com/bps"
58         ,("OK",))
59
60 def display_help(_menuitem):
61         GtkExtra.message_box("BPS Operation Instructions",
62         "1. Select the benchmark programs you wish to perform by pressing its button.\n2. Press the \"Run selected benchmarks\" button to begin running the benchmarks.\n3. Once complete, an html file of output can be obtained by pressing the \"Create html file of results\" button.  "
63         ,("OK",))
64
65 def display_running_window(benchName):
66         GtkExtra.message_box("Benchmark Starting",
67         benchName+" will be started, press ok to continue"
68         "",("OK",))     
69
70 #Variable toggling
71
72 def toggle_status(val):
73         if status[val]==TRUE:
74                 status[val]=FALSE
75         else:
76                 status[val]=TRUE
77
78 def toggle_prompting():
79         if prompting[0]==TRUE:
80                 prompting[0]=FALSE
81                 string="OFF"
82         else:
83                 prompting[0]=TRUE
84                 string="ON"
85
86 #Interface creation
87
88 def create_file_selection(entry):
89         win = GtkFileSelection("Log directory selection")
90         win.set_filename(logdirectory[0])
91         win.set_modal(TRUE)
92         win.hide_fileop_buttons()
93         win.connect("delete_event", delete_event)
94
95         def file_selection_ok(_button, fs=win,entry=entry):
96                 logdirectory[0]=fs.get_filename()
97                 if not os.path.isdir(logdirectory[0]):
98                         templog=logdirectory[0]
99                         logdirectory[0]=templog[0:string.rfind(templog,'/')+1]
100                         entry.set_text(logdirectory[0])
101                 if os.path.samefile(logdirectory[0],os.environ['HOME']):
102                         os.system("ls")
103                 else:
104                          entry.set_text(logdirectory[0])
105                 fs.hide()
106
107         win.ok_button.connect("clicked", file_selection_ok)
108         win.cancel_button.connect("clicked", win.hide)
109         win.show()
110
111 def create_port_input(benchName):
112         win = GtkWindow()
113         win.set_usize(300,-1)
114         win.connect("delete_event", delete_event)
115         win.set_title(benchName+" Node Info Entry")
116         win.set_modal(TRUE)
117         box1 = GtkVBox()
118         win.add(box1)
119         box1.show()
120         box2=GtkHBox(spacing = 5)
121         box2.set_border_width(10)
122         box1.pack_start(box2)
123         box2.show()
124         frame = GtkFrame("Receiver Node")
125         box1.pack_start(frame)
126         frame.show()
127         box3=GtkVBox(spacing=5)
128         box3.set_border_width(5)
129         frame.add(box3)
130         box3.show()
131         entry = GtkEntry()
132         entry.set_text(port1[0])
133         box3.pack_start(entry)
134         entry.show()
135         separator = GtkHSeparator()
136         box1.pack_start(separator, expand=FALSE)
137         separator.show()
138         box2=GtkVBox(spacing=10)
139         box2.set_border_width(10)
140         box1.pack_start(box2, expand=FALSE)
141         box2.show()
142         frame = GtkFrame("Sender Node")
143         box1.pack_start(frame)
144         frame.show()
145         box3=GtkVBox(spacing=5)
146         box3.set_border_width(5)
147         frame.add(box3)
148         box3.show()
149         entry1 = GtkEntry()
150         entry1.set_text(port2[0])
151         box3.pack_start(entry1)
152         entry1.show()
153         separator = GtkHSeparator()
154         box1.pack_start(separator, expand=FALSE)
155         separator.show()
156         box2=GtkVBox(spacing=10)
157         box2.set_border_width(10)
158         box1.pack_start(box2, expand=FALSE)
159         box2.show()
160 #       frame=GtkFrame("Interface")
161 #       box2.pack_start(frame)
162 #       frame.show()
163 #       interBox = GtkCombo()
164 #       frame.add(interBox)
165 #       interBox.set_popdown_strings(interfaces)
166 #       if (benchName=="Netpipe"):
167 #               interBox.entry.set_text(pipeinterface[0])
168 #       else:
169 #               interBox.entry.set_text(perfinterface[0])
170 #       interBox.show()
171 #       def get_info(_button, win=win, entry=entry, interBox=interBox,benchName=benchName):
172         def get_info(_button, win=win, entry=entry, entry1=entry1):
173                 port1[0]=entry.get_text()
174                 port2[0]=entry1.get_text()
175 #               if (benchName=="Netpipe"):
176 #                       pipeinterface[0]=interBox.entry.get_text()
177 #               else:
178 #                       perfinterface[0]=interBox.entry.get_text()
179                 win.hide()
180         button2=GtkButton("Ok")
181         button2.set_flags(CAN_DEFAULT)
182         box2.pack_start(button2)
183         button2.grab_default()
184         button2.show()
185         button2.connect("clicked",get_info)
186         win.show()
187
188 def create_menu(num,info):
189         menu = GtkMenu()
190         group = None
191         for i in range(num):
192                 menuitem=GtkRadioMenuItem(group,info[i])
193                 group = menuitem
194                 menu.append(menuitem)
195                 menuitem.show()
196         return menu
197
198 def create_machine_input():
199         win = GtkWindow()
200         win.set_usize(300,-1)
201         win.connect("delete_event", delete_event)
202         win.set_title("Machine Info Entry")
203         box1 = GtkVBox()
204         win.add(box1)
205         box1.show()
206         frame = GtkFrame("Motherboard Manufacturer")
207         box1.pack_start(frame)
208         frame.show()
209         entry1 = GtkEntry()
210         frame.add(entry1)
211         entry1.set_text(mboardman[0])
212         entry1.show()
213         frame=GtkFrame("Motherboard Model")
214         box1.pack_start(frame)
215         frame.show()
216         entry5=GtkEntry()
217         frame.add(entry5)
218         entry5.set_text(mboardmod[0])
219         entry5.show()
220         frame = GtkFrame("Memory Type")
221         box1.pack_start(frame)
222         frame.show()
223         entry2 = GtkEntry()
224         frame.add(entry2)
225         entry2.set_text(memtype[0])
226         entry2.show()
227         frame = GtkFrame("Interconnects")
228         box1.pack_start(frame)
229         frame.show()
230         entry3 = GtkEntry()
231         frame.add(entry3)
232         entry3.set_text(netcon[0])
233         entry3.show()
234         frame = GtkFrame("Linux Distribution")
235         box1.pack_start(frame)
236         frame.show()
237         entry4 = GtkEntry()
238         frame.add(entry4)
239         entry4.set_text(linux[0])
240         entry4.show()
241         separator = GtkHSeparator()
242         box1.pack_start(separator, expand=FALSE)
243         separator.show()
244         box4=GtkVBox(spacing=10)
245         box4.set_border_width(10)
246         box1.pack_start(box4, expand=FALSE)
247         box4.show()
248         def get_info(_button, win=win, entry1=entry1, entry2=entry2, entry3=entry3, entry4=entry4,entry5=entry5):
249                 mboardman[0]=entry1.get_text()
250                 mboardmod[0]=entry5.get_text()
251                 memtype[0]=entry2.get_text()
252                 netcon[0]=entry3.get_text()
253                 linux[0]=entry4.get_text()
254                 win.hide()
255         button=GtkButton("Ok")
256         button.set_flags(CAN_DEFAULT)
257         box4.pack_start(button)
258         button.grab_default()
259         button.show()
260         button.connect("clicked",get_info)
261         win.show()
262
263 def create_npb_input(run_mode):
264         win = GtkWindow()
265         win.set_usize(300,-1)   
266         win.connect("delete_event", delete_event)
267         win.set_title("NAS Benchmark Info Entry")
268         box1 = GtkVBox()
269         win.add(box1)
270         box1.show()
271         box2=GtkHBox(spacing = 5)
272         box2.set_border_width(10)
273         box1.pack_start(box2)
274         box2.show()
275         frame = GtkFrame("Compiler")
276         box2.pack_start(frame)
277         frame.show()
278         compilerbox=GtkCombo()
279         frame.add(compilerbox)
280         compilerbox.set_popdown_strings(cm)
281         compilerbox.entry.set_text(compiler[0])
282         compilerbox.show()
283         frame = GtkFrame("MPI Version")
284         box2.pack_start(frame)
285         frame.show()
286         mpibox=GtkCombo()
287         frame.add(mpibox)
288         mpibox.set_popdown_strings(mpis)
289         mpibox.entry.set_text(mpi[0])
290         mpibox.show()
291         box3=GtkHBox(spacing = 5)
292         box3.set_border_width(10)
293         box1.pack_start(box3)
294         box3.show()
295         frame=GtkFrame("Test Size")
296         box3.pack_start(frame)
297         frame.show()
298         testbox=GtkCombo()
299         frame.add(testbox)
300         testbox.set_popdown_strings(ts)
301         testbox.entry.set_text(testsize[0])
302         testbox.show()
303         frame = GtkFrame("Number of Processors")
304         box3.pack_start(frame)
305         frame.show()
306         processorbox=GtkCombo()
307         frame.add(processorbox)
308         processorbox.set_popdown_strings(numprocs)
309         processorbox.entry.set_text(numproc[0])
310         processorbox.show()
311         frame=GtkFrame("Machine Names (<name1>,<name2>,...,<namen>)")
312         box1.pack_start(frame)
313         frame.show()
314         machineentry=GtkEntry()
315         frame.add(machineentry)
316         machineentry.set_text(machinename[0])
317         machineentry.show()
318         sep=GtkHSeparator()
319         box1.pack_start(sep)
320         sep.show()
321         box4=GtkHBox(spacing = 5)
322         box4.set_border_width(10)
323         box1.pack_start(box4)
324         box4.show()
325         if (run_mode):
326                 button=GtkButton("Run NAS")
327         else:
328                 button=GtkButton("OK")
329         box4.pack_start(button)
330
331         def npb_ok(_button,win=win,processorbox=processorbox,
332                         testbox=testbox,compilerbox=compilerbox,
333                         mpibox=mpibox,run_mode=run_mode,machineentry=machineentry):
334                 numproc[0]=processorbox.entry.get_text()
335                 testsize[0]=testbox.entry.get_text()
336                 compiler[0]=compilerbox.entry.get_text()
337                 mpi[0]=mpibox.entry.get_text()
338                 machinename[0]=machineentry.get_text()
339                 if(run_mode): os.system("run_suite -c "+compiler[0]+" -n "+numproc[0]+" -t "+testsize[0]+" -m "+mpi[0])
340                 win.hide()
341
342         button.show()
343         button.connect("clicked",npb_ok)
344         win.show()
345
346 def create_log_select():
347         win = GtkWindow()
348         win.set_usize(300,-1)   
349         win.connect("delete_event", delete_event)
350         win.set_title("Log Directory Info Entry")
351         box1 = GtkVBox()
352         win.add(box1)
353         box1.show()
354         box2 = GtkHBox(spacing = 5)
355         box2.set_border_width(10)
356         box1.pack_start(box2)
357         box2.show()
358         frame = GtkFrame("Log Directory")
359         box2.pack_start(frame)
360         frame.show()
361         box3=GtkHBox(spacing=5)
362         box3.set_border_width(5)
363         frame.add(box3)
364         box3.show()
365         entry = GtkEntry()
366         entry.set_text(logdirectory[0])
367         box3.pack_start(entry)
368         entry.show()
369         button = GtkButton("Browse")
370         box3.add(button)
371         button.show()
372         def browse(_button, win=win, entry=entry):
373                 create_file_selection(entry)
374         button.connect("clicked",browse)
375         separator = GtkHSeparator()
376         box1.pack_start(separator, expand=FALSE)
377         separator.show()
378         box2=GtkVBox(spacing=10)
379         box2.set_border_width(10)
380         box1.pack_start(box2, expand=FALSE)
381         box2.show()
382
383         def logdirok(_button,win=win,entry=entry):
384                 logdirectory[0]=entry.get_text()
385                 logdirectory[0]=os.path.expanduser(logdirectory[0])
386                 win.hide()
387
388         button2 = GtkButton("Ok")
389         button2.set_flags(CAN_DEFAULT)
390         box2.pack_start(button2)
391         button2.grab_default()
392         button2.show()
393         button2.connect("clicked",logdirok)
394         win.show()
395
396 #Process execution and handling
397
398 def html_script():
399         os.system("bps-html "+logdirectory[0])
400
401 def run_html():
402         win = GtkWindow()
403         win.set_usize(300,-1)   
404         win.connect("delete_event",delete_event)
405         win.set_title("Log Directory Info Entry")
406         box1=GtkVBox()
407         win.add(box1)
408         box1.show()
409         box2=GtkHBox(spacing = 5)
410         box2.set_border_width(10)
411         box1.pack_start(box2)
412         box2.show()
413         frame=GtkFrame("Log File Directory")
414         box2.pack_start(frame)
415         frame.show()
416         box3=GtkHBox(spacing=5)
417         box3.set_border_width(5)
418         frame.add(box3)
419         box3.show()
420         entry=GtkEntry()
421         entry.set_text(logdirectory[0])
422         box3.pack_start(entry)
423         entry.show()
424         button=GtkButton("Browse")
425         box3.add(button)
426         def browse(_button, entry=entry):
427                 create_file_selection(entry)   
428         button.connect("clicked",browse)
429         button.show()
430         separator=GtkHSeparator()
431         box3.show()
432         box1.pack_start(separator,expand=FALSE)
433         separator.show()
434         box2=GtkVBox(spacing=10)
435         box2.set_border_width(10)
436         box1.pack_start(box2, expand=FALSE)
437         box2.show()
438         def run_script(_button, win=win, entry=entry):
439                 logdirectory[0]=entry.get_text()
440                 html_script()
441                 win.hide()
442         button2 = GtkButton("Generate Html File")
443         button2.set_flags(CAN_DEFAULT)
444         box2.pack_start(button2)
445         button2.grab_default()
446         button2.show()
447         button2.connect("clicked",run_script)   
448         win.show()
449
450 def run_bench():
451         over_write=" -w"
452         machine_info=" -i \""+mboardman[0]+","+mboardmod[0]+","+memtype[0]+","+netcon[0]+","+linux[0]+"\""
453         if not prompting[0]:
454                 GtkExtra.message_box("Beginning benches",
455                 "Selected benchmarks will be run\nNo further prompting will be given."
456                 ,("OK",))
457
458         for i in range(0,7):
459                 if i==0 and status[i]:
460                         if prompting[0]: display_running_window("Bonnie++")
461                         os.system("bps"+over_write+" -l "+logdirectory[0]+machine_info+" -b")
462                         over_write=""
463                 if i==1 and status[i]:
464                         if prompting[0]: display_running_window("Stream")
465                         os.system("bps"+over_write+" -l "+logdirectory[0]+machine_info+" -s")
466                         over_write=""
467                 if i==2 and status[i]:
468                         try:
469                                 socket.gethostbyname(port1[0])
470                                 val=1;
471                         except:
472                                 GtkExtra.message_box("Invalid Node",
473                                 "The node " + port1[0] + " is unreachable"
474                                 ,("OK",))
475                                 val=0;
476                         try:
477                                 socket.gethostbyname(port2[0])
478                                 val=1;
479                         except:
480                                 GtkExtra.message_box("Invalid Node",
481                                 "The node " + port2[0] + " is unreachable"
482                                 ,("OK",))
483                                 val=0;
484                                
485                         if (port1[0]=="" or port2[0]==""):
486                                 GtkExtra.message_box("No Node Initialization",
487                                 "A remote node for Netperf has not been specified\nSpecify the node by clicking the Netperf section under Settings"
488                                 ,("OK",))
489                         elif val==1:
490                                 if (prompting[0]): display_running_window("Netperf")
491                                 tempstring = "bps"+over_write+" -l "+logdirectory[0]+machine_info+" -f \""+port2[0]+","+port1[0]+"\""
492                                 os.system(tempstring)   
493                                 over_write=""
494                 if i==3 and status[i]:
495                         try:
496                                 socket.gethostbyname(port1[0])
497                                 val=1;
498                         except:
499                                 GtkExtra.message_box("Invalid Node",
500                                 "The node " + port1[0] + " is unreachable"
501                                 ,("OK",))
502                                 val=0;
503                         try:
504                                 socket.gethostbyname(port2[0])
505                                 val=1;
506                         except:
507                                 GtkExtra.message_box("Invalid Node",
508                                 "The node " + port2[0] + " is unreachable"
509                                 ,("OK",))
510                                 val=0;
511                                
512                         if (port1[0]=="" or port2[0]==""):
513                                 GtkExtra.message_box("No Node Initialization",
514                                 "A remote node for Netpipe has not been specified\nSpecify the node by clicking the Netpipe section under Settings"
515                                 ,("OK",))
516                         elif val==1:
517                                 if (prompting[0]): display_running_window("Netpipe")
518                                 tempstring="bps"+over_write+" -l "+logdirectory[0]+machine_info+" -p \""+port2[0]+","+port1[0]+"\""
519                                 os.system(tempstring)
520                                 over_write=""
521                 if i==4 and status[i]:
522                         if prompting[0]: display_running_window("NAS")
523                         tempstring="bps" + over_write + " -l "+logdirectory[0]+machine_info+" -n "+compiler[0]+","+numproc[0]+","+testsize[0]+","+mpi[0]+","+machinename[0]
524                         os.system(tempstring)
525                         over_write=""
526                 if i==5 and status[i]:         
527                         if prompting[0]: display_running_window("UnixBench")
528                         os.system("bps"+over_write+" -l "+logdirectory[0]+machine_info+" -u")
529                         over_write=""
530                 if i==6 and status[i]:
531                         if prompting[0]: display_running_window("LMBench")
532                         os.system("bps"+over_write+" -l "+logdirectory[0]+machine_info+" -m")
533                         over_write=""
534         if over_write=="": return 1
535         else: return 0
536                        
537 #main function - separate from the other "create" functions due to
538 #Python scoping rules
539
540 def create_main_window():
541         buttons = {}
542         def html_hook(_b):
543                 run_html()
544        
545         def select_all(_b,buttons=buttons):
546                 for i in range(0,7):
547                         buttons[i].set_active(allstatus[0])
548                         status[i]=allstatus[0]
549                 allstatus[0]=not allstatus[0]
550                        
551         def run_benches(_b,buttons=buttons):
552                 ran=run_bench()
553                 for i in range(0,7):
554                         buttons[i].set_active(FALSE)
555                 if (ran==1): GtkExtra.message_box("Benchmarks Completed",
556                 "All selected benchmarks have completed"
557                 ,("OK",))
558         win = GtkWindow()
559         win.set_name("main window")
560         win.set_usize(700,-1)   
561         win.set_uposition(20, 20)
562         win.connect("destroy", mainquit)
563         win.connect("delete_event", mainquit)
564         win.set_title("Paralogic Beowulf Performance Suite")
565         box1 = GtkVBox()
566         win.add(box1)
567         box1.show()
568         file_menu = GtkMenu()
569         run_item = GtkMenuItem("Run")
570         select_item = GtkMenuItem("(Un)Select All")
571         html_item = GtkMenuItem("Create Html")
572         exit_item = GtkMenuItem("Exit")
573         file_menu.append(run_item)
574         file_menu.append(select_item)
575         file_menu.append(html_item)
576         file_menu.append(exit_item)
577         run_item.connect("activate",run_benches)
578         run_item.show()
579         select_item.connect("activate",select_all)
580         select_item.show()
581         html_item.connect("activate",html_hook)
582         html_item.show()
583         exit_item.connect("activate",do_exit)
584         exit_item.show()
585
586         def perf_port_hook(_b):
587                 create_port_input("Netperf")
588         def pipe_port_hook(_b):
589                 create_port_input("Netpipe")
590         def log_hook(_b):
591                 create_log_select()
592         def prompt_hook(_b):
593                 toggle_prompting()     
594         def npb_hook(_b):
595                 create_npb_input(FALSE)
596         def machine_hook(_b):
597                 create_machine_input()
598
599         settings_menu = GtkMenu()
600         logdir_item = GtkMenuItem("Log Dir")
601         port_item = GtkMenuItem("Netperf")
602         netpipe_item = GtkMenuItem("Netpipe")
603         npb_item = GtkMenuItem("NAS")
604         machine_item = GtkMenuItem("Machine Info")
605         prompt_item = GtkCheckMenuItem("Prompting")
606         prompt_item.set_active(prompting[0])
607         settings_menu.append(logdir_item)
608         settings_menu.append(port_item)
609         settings_menu.append(netpipe_item)
610         settings_menu.append(npb_item)
611         settings_menu.append(machine_item)
612         settings_menu.append(prompt_item)
613         logdir_item.connect("activate",log_hook)
614         logdir_item.show()
615         port_item.connect("activate",perf_port_hook)
616         port_item.show()
617         netpipe_item.connect("activate",pipe_port_hook)
618         netpipe_item.show()
619         npb_item.connect("activate",npb_hook)
620         npb_item.show()
621         machine_item.connect("activate", machine_hook)
622         machine_item.show()
623         prompt_item.connect("toggled",prompt_hook)
624         prompt_item.show()
625         help_menu = GtkMenu()
626         general_item = GtkMenuItem("General Operation")
627         bench_item = GtkMenuItem("Benchmark Info")
628         about_item = GtkMenuItem("About")
629         help_menu.append(general_item)
630         help_menu.append(bench_item)
631         help_menu.append(about_item)
632         general_item.connect("activate",display_help)
633         bench_item.connect("activate",display_info)
634         about_item.connect("activate",display_about)
635         general_item.show()
636         bench_item.show()
637         about_item.show()
638
639         menu_bar = GtkMenuBar()
640         box1.pack_start(menu_bar,expand=FALSE)
641         menu_bar.show()
642         file_item = GtkMenuItem("File")
643         file_item.show()
644         file_item.set_submenu(file_menu)
645         settings_item = GtkMenuItem("Settings")
646         settings_item.show()   
647         settings_item.set_submenu(settings_menu)
648         help_item = GtkMenuItem("Help")
649         help_item.show()
650         help_item.set_submenu(help_menu)
651         menu_bar.append(file_item)
652         menu_bar.append(settings_item)
653         menu_bar.append(help_item)
654
655         frame = GtkFrame("Benchmarks")
656         box1.pack_start(frame)
657         frame.show()
658         table = GtkTable(2, 4, FALSE)
659         table.set_col_spacings(5)
660         table.set_border_width(10)
661         frame.add(table)
662         table.show()
663
664         box2 = GtkHButtonBox()
665         box2.set_usize(-1,-1)
666         box2.set_spacing(20)
667         box2.set_layout(BUTTONBOX_SPREAD)
668         box2.set_border_width(5)
669         box1.add(box2)
670         box2.show()
671
672         def bbox_bonnie(_b, bbox=box2):
673                 toggle_status(0)
674         def bbox_stream(_b, bbox=box2):
675                 toggle_status(1)
676         def bbox_netperf(_b, bbox=box2):
677                 toggle_status(2)
678         def bbox_netpipe(_b, bbox=box2):
679                 toggle_status(3)
680         def bbox_npb(_b, bbox=box2):
681                 toggle_status(4)
682         def bbox_unixbench(_b, bbox=box2):
683                 toggle_status(5)               
684         def bbox_lmbench(_b, bbox=box2):
685                 toggle_status(6)
686
687         buttons[0] = GtkToggleButton("Bonnie++")
688         buttons[0].connect("toggled",bbox_bonnie)
689         table.attach(buttons[0],1,2,1,2)
690         buttons[0].show()
691
692         buttons[1] = GtkToggleButton("Stream")
693         buttons[1].connect("toggled",bbox_stream)
694         table.attach(buttons[1],1,2,2,3)
695         buttons[1].show()
696
697         buttons[2] = GtkToggleButton("NetPerf")
698         buttons[2].connect("toggled",bbox_netperf)
699         table.attach(buttons[2],1,2,3,4)
700         buttons[2].show()
701
702         buttons[3] = GtkToggleButton("NetPipe")
703         buttons[3].connect("toggled",bbox_netpipe)
704         table.attach(buttons[3],2,3,1,2)
705         buttons[3].show()
706
707         buttons[4] = GtkToggleButton("NAS")
708         buttons[4].connect("toggled",bbox_npb)
709         table.attach(buttons[4],2,3,2,3)
710         buttons[4].show()
711
712         buttons[5] = GtkToggleButton("UnixBench")
713         buttons[5].connect("toggled",bbox_unixbench)
714         table.attach(buttons[5],2,3,3,4)
715         buttons[5].show()
716
717         buttons[6] = GtkToggleButton("LMBench")
718         buttons[6].connect("toggled",bbox_lmbench)
719         table.attach(buttons[6],1,2,4,5)
720         buttons[6].show()
721        
722         button = GtkButton("(Un)Select all")
723         button.connect("clicked", select_all)
724         box2.add(button)
725         button.show()
726        
727         button = GtkButton("Run selected benches")
728         button.connect("clicked", run_benches)
729         box2.add(button)
730         button.show()
731
732         button = GtkButton("Create html file of results")
733         button.connect("clicked", html_hook)
734         box2.add(button)
735         button.show()
736
737         button = GtkButton("Exit BPS")
738         button.connect("clicked", do_exit)
739         button.set_flags(CAN_DEFAULT)
740         box2.add(button)
741         button.grab_default()
742         button.show()
743         win.show()
744
745 def main():
746         create_main_window()
747         mainloop()
748
749 #try:
750         #os.environ['DISPLAY']
751 main()
752 #except:
753 #       print "Set your DISPLAY variable and try again"
754
Note: See TracBrowser for help on using the browser.