source: trunk/Mars/datacenter/macros/plotusage.C@ 15574

Last change on this file since 15574 was 9120, checked in by Daniela Dorner, 16 years ago
*** empty log message ***
File size: 3.9 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: plotusage.C,v 1.2 2008-08-15 12:14:52 dorner Exp $
3! --------------------------------------------------------------------------
4!
5! *
6! * This file is part of MARS, the MAGIC Analysis and Reconstruction
7! * Software. It is distributed to you in the hope that it can be a useful
8! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
9! * It is distributed WITHOUT ANY WARRANTY.
10! *
11! * Permission to use, copy, modify and distribute this software and its
12! * documentation for any purpose is hereby granted without fee,
13! * provided that the above copyright notice appear in all copies and
14! * that both that copyright notice and this permission notice appear
15! * in supporting documentation. It is provided "as is" without express
16! * or implied warranty.
17! *
18!
19!
20! Author(s): Thomas Bretz, 06/2008 <mailto:tbretz@astro.uni-wuerzburg.de>
21! Author(s): Daniela Droner, 08/2008 <mailto:tbretz@astro.uni-wuerzburg.de>
22!
23! Copyright: MAGIC Software Development, 2000-2008
24!
25!
26\* ======================================================================== */
27
28/////////////////////////////////////////////////////////////////////////////
29//
30// plotusage.C
31// ===========
32//
33// This macro is used to read parameters (condor usage of the cluster) from
34// the DB and plot them.
35//
36// Usage:
37// .x plotusage.C --> all values in the DB are plotted
38//
39// Make sure, that database and password are corretly set in a resource
40// file called sql.rc and the resource file is found.
41//
42/////////////////////////////////////////////////////////////////////////////
43#include "plotdb.C"
44
45void plotallusage(MPlot &plot)
46{
47 // plot.SetGroupBy(MPlot::kGroupByDay);
48
49 plot.SetPrimaryDate("CondorStatus.fTime");
50
51 // plot.SetPrimaryNumber("Sequences.fSequenceFirst");
52 // plot.SetCondition("((Sequences.fSequenceFirst>95000 AND Sequences.fSequenceFirst<261988) OR Sequences.fSequenceFirst>267750)"
53 // "AND Star.fAvgTemperature<25 AND Star.fMuonNumber>500");
54
55 plot.SetSecondary("CondorStatus.fLoadTotal");
56 plot.SetDescription("Total number of available CPUs;Available CPUs", "TotCPU");
57 plot.Plot("CondorStatus.fNumTotal as CPUs", 0, 50, 1);
58
59 plot.SetSecondary("CondorStatus.fLoadClaimed");
60 plot.SetDescription("Total number of claimed CPUs;Claimed CPUs", "ClaimedCPU");
61 plot.Plot("CondorStatus.fNumClaimed as CPUs", 0, 50, 1);
62
63 plot.SetSecondary("CondorStatus.fNumClaimed");
64 plot.SetDescription("Total load of available CPUs;Total load", "AbsTotLoad");
65 plot.Plot("CondorStatus.fLoadTotal", 0, 50, 1);
66
67 plot.SetSecondary("CondorStatus.fNumClaimed");
68 plot.SetDescription("Total load of claimed CPUs;Claimed load", "AbsClaimedLoad");
69 plot.Plot("CondorStatus.fLoadClaimed", 0, 50, 1);
70
71 plot.SetSecondary("CondorStatus.fNumClaimed");
72 plot.SetDescription("Relative load per available CPUs;Relative load", "RelTotLoad");
73 plot.Plot("CondorStatus.fLoadTotal/CondorStatus.fNumTotal", 0, 1.2, 0.02);
74
75 plot.SetSecondary("CondorStatus.fNumClaimed");
76 plot.SetDescription("Relative load per claimed CPUs;Relative load", "RelClaimedLoad");
77 plot.Plot("CondorStatus.fLoadClaimed/CondorStatus.fNumClaimed", 0, 1.2, 0.02);
78}
79
80int plotusage(TString path="")
81{
82 MSQLMagic serv("sql.rc");
83 if (!serv.IsConnected())
84 {
85 cout << "ERROR - Connection to database failed." << endl;
86 return 0;
87 }
88
89 cout << "plotusage" << endl;
90 cout << "---------" << endl;
91 cout << endl;
92 cout << "Connected to " << serv.GetName() << endl;
93 cout << endl;
94
95 MStatusDisplay *d = new MStatusDisplay;
96 d->SetWindowName(serv.GetName());
97 d->SetTitle(serv.GetName());
98
99 MPlot plot(serv);
100 plot.SetDisplay(d);
101
102 plotallusage(plot);
103
104 d->SaveAsRoot(path+"plotusage.root");
105// d->SaveAsPS("plotusage.ps");
106
107 return 1;
108}
109
Note: See TracBrowser for help on using the repository browser.