本文整理汇总了C++中TDatime::AsSQLString方法的典型用法代码示例。如果您正苦于以下问题:C++ TDatime::AsSQLString方法的具体用法?C++ TDatime::AsSQLString怎么用?C++ TDatime::AsSQLString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDatime
的用法示例。
在下文中一共展示了TDatime::AsSQLString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plotSmartCacheRequests
//--------------------------------------------------------------------------------------------------
void plotSmartCacheRequests()
{
TDatime date;
TString dateTime = date.AsSQLString();
TString text;
TString save;
long int durationHour = 3600;
long int durationDay = 24 * 3600;
long int durationWeek = 7 * 24 * 3600;
long int durationMonth = 4 * 7 * 24 * 3600;
long int xStart, xStop;
time_t t;
time(&t);
long int time = (long int) t;
// Access the database just once
TString timeSeriesFile("requests.txt");
TString dbAccess("/home/cmsprod/DynamicData/SmartCache/Client/dumpSmartCacheHistoryDb.py");
// remove potentially existing old file
TString rmDbInfo = TString(".! rm -f ")+timeSeriesFile;
gROOT->ProcessLine(rmDbInfo.Data());
// create fresh input file
TString getDbInfo = TString(".! ") + dbAccess + TString(" -q");
gROOT->ProcessLine(getDbInfo.Data());
// All time
xStart = 0;
xStop = time;
plot(xStart, xStop, "All time at "+dateTime, "AllTime");
// Month
xStart = time - durationMonth;
xStop = time;
plot(xStart, xStop, "Last month at "+dateTime, "LastMonth");
// Week
xStart = time - durationWeek;
xStop = time;
plot(xStart, xStop, "Last week at "+dateTime, "LastWeek");
// Day
xStart = time - durationDay;
xStop = time;
plot(xStart, xStop, "Last day at "+dateTime, "LastDay");
// Hour
xStart = time - durationHour;
xStop = time;
plot(xStart, xStop, "Last hour at "+dateTime, "LastHour");
return;
}
示例2: plotSmartCacheTransferRate
//--------------------------------------------------------------------------------------------------
void plotSmartCacheTransferRate()
{
TDatime date;
TString dateTime = date.AsSQLString();
TString text;
long int durationHour = 3600;
long int durationDay = 24 * 3600;
long int durationWeek = 7 * 24 * 3600;
long int durationMonth = 4 * 7 * 24 * 3600;
long int xStart, xEnd;
// Plot SmartCache tranfers during the last hour, day, week, month
time_t t;
time(&t);
long int time = (long int) t;
// Access the database just once
TString timeSeriesFile("timeSeriesOfRates.txt");
TString dbAccess("/home/cmsprod/DynamicData/SmartCache/Client/snapshotSmartCacheHistoryDb.py");
// remove potentially existing old file
TString rmDbInfo = TString(".! rm -f ")+timeSeriesFile;
gROOT->ProcessLine(rmDbInfo.Data());
// create fresh input file
TString getDbInfo = TString(".! ") + dbAccess + TString(" -q");
gROOT->ProcessLine(getDbInfo.Data());
// hour
text = TString("Last Hour at ") + dateTime;
xStart = time-durationHour; xEnd = time; plot(xStart,xEnd,text,"transferRateLastHour.png");
// day
text = TString("Last Day at ") + dateTime;
xStart = time-durationDay; xEnd = time; plot(xStart,xEnd,text,"transferRateLastDay.png");
// week
text = TString("Last Week at ") + dateTime;
xStart = time-durationWeek; xEnd = time; plot(xStart,xEnd,text,"transferRateLastWeek.png");
// week
text = TString("Last Month at ") + dateTime;
xStart = time-durationMonth; xEnd = time; plot(xStart,xEnd,text,"transferRateLastMonth.png");
}
示例3: plotSiteStatus
//--------------------------------------------------------------------------------------------------
void plotSiteStatus()
{
TString fileName = gSystem->Getenv("SITE_MONITOR_FILE");
TString monitorDB = gSystem->Getenv("MONITOR_DB");
TDatime date;
TString dateTime = date.AsSQLString();
TString pngFileName = fileName + TString(".png");
TString inputFile = fileName;
// Make sure we have the right styles
MitRootStyle::Init();
// Now open our database output
printf(" Input file: %s\n",inputFile.Data());
ifstream input;
input.open(inputFile.Data());
TString siteName;
Int_t nLines=0;
Double_t total=0, used=0, toDelete=0, lastCp=0;
Double_t xMin=0, xMaxTb=0, xMax=0;
// Loop over the file to determine our boundaries
//-----------------------------------------------
while (1) {
// read in
input >> siteName >> total >> used >> toDelete >> lastCp;
// check it worked
if (! input.good())
break;
// show what we are reading
if (nLines < 5)
printf(" site=%s, total=%8f used=%f toDelete=%f lastCp=%f\n",
siteName.Data(), total, used, toDelete, lastCp);
if (used>xMax)
xMax = used;
nLines++;
}
input.close();
printf(" \n");
printf(" Found %d entries.\n",nLines);
printf(" Found %.3f as maximum.\n",xMax);
printf(" \n");
// book our histogram
xMaxTb = 999.;
xMax = 1.2;
TString titles;
titles = TString();
TH1D *hTotal = new TH1D("Total", "Total Space", 1000./20,xMin,xMaxTb);
MitRootStyle::InitHist(hTotal,"","",kBlack);
hTotal->SetTitle("; Total Storage [TB]; Number of Sites");
TH1D *hUsed = new TH1D("Used", "Used Space", 1000./20,xMin,xMaxTb);
MitRootStyle::InitHist(hUsed, "","",kBlack);
hUsed ->SetTitle("; Used Storage [TB]; Number of Sites");
TH1D *hToDelete = new TH1D("ToDelete","Space to Release", 1000./20,xMin,xMaxTb);
MitRootStyle::InitHist(hToDelete,"","",kBlack);
hToDelete->SetTitle("; Space to Release [TB]; Number of Sites");
TH1D *hLastCp = new TH1D("LastCp", "Last Copy space", 1000./20,xMin,xMaxTb);
MitRootStyle::InitHist(hLastCp, "","",kBlack);
hLastCp ->SetTitle("; Last Copy Size [TB]; Number of Sites");
TH1D *hLastCpFr = new TH1D("LastCpFr","Last CP fraction",20, xMin,xMax);
MitRootStyle::InitHist(hLastCpFr,"","",kBlack);
hLastCpFr->SetTitle("; Last Copy Filling Fraction; Number of Sites");
input.open(inputFile.Data());
while (1) {
// read in
input >> siteName >> total >> used >> toDelete >> lastCp;
// check it worked
if (! input.good())
break;
hTotal ->Fill(total);
hUsed ->Fill(used);
hToDelete->Fill(toDelete);
hLastCp ->Fill(lastCp);
hLastCpFr->Fill(lastCp/total);
// print some warnings
if (lastCp/total > 0.7) {
printf(" WARNING - Last copy space too large: %3.0f%% at %s\n",
lastCp/total*100.,siteName.Data());
}
nLines++;
}
input.close();
// draw the plots
//.........这里部分代码省略.........