81 void UpdatePerformance(
Double_t time);
90TPacketizerUnit::TSlaveStat::TSlaveStat(
TSlave *slave,
TList *input)
92 fRate(0), fTimeInstant(0), fCircLvl(5)
95 fCircNtp =
new TNtupleD(
"Speed Circ Ntp",
"Circular process info",
"tm:ev");
96 fCircNtp->SetDirectory(0);
98 fCircLvl = (fCircLvl > 0) ? fCircLvl : 5;
99 fCircNtp->SetCircular(fCircLvl);
107TPacketizerUnit::TSlaveStat::~TSlaveStat()
115void TPacketizerUnit::TSlaveStat::UpdatePerformance(
Double_t time)
119 Int_t ne = fCircNtp->GetEntries();
122 fCircNtp->Fill(0., 0);
127 fCircNtp->GetEntry(ne-1);
132 fCircNtp->GetEntry(0);
133 Double_t dtime = (ttot > ar[0]) ? ttot - ar[0] : ne+1 ;
135 fRate = nevts / dtime;
137 Info("UpdatePerformance", "time:%
f, dtime:%
f, nevts:%lld, speed: %
f",
138 time, dtime, nevts, fRate);
150 Long64_t lastEntries = st->GetEntries() - fStatus->GetEntries();
152 fStatus->SetLastProcTime(0.);
160 Error(
"AddProcessed",
"status arg undefined");
176 PDB(kPacketizer,1)
Info(
"TPacketizerUnit",
"enter (num %lld)", num);
189 Info(
"TPacketizerUnit",
"forcing the same cycles on each worker");
197 Info(
"TPacketizerUnit",
"size of the calibration packets: %.2f %% of average number per worker",
fCalibFrac);
203 Warning(
"TPacketizerUnit",
"PROOF_PacketizerTimeLimit is deprecated: use PROOF_MaxPacketTime instead");
243 Info(
"TPacketizerUnit",
"node '%s' has NO active worker: excluded from work distribution", slave->
GetOrdinal());
251 Warning(
"TPacketizerUnit",
"some problems assigning work");
258 PDB(kPacketizer,1)
Info(
"TPacketizerUnit",
"return");
267 Error(
"AssignWork",
"assigned a negative number (%lld) of cycles - protocol error?", num);
273 Info(
"AssignWork",
"assigned %lld additional cycles (new total: %lld)", num,
fTotalEntries);
331 while ((key = nxw()) != 0) {
333 if (slstat && slstat->GetProgressStatus() && slstat->GetEntriesProcessed() > 0) {
335 currate += slstat->GetProgressStatus()->GetCurrentRate();
356 Warning(
"GetNextPacket",
"Received a packet request from an unknown slave: %s:%s",
365 Double_t latency = 0., proctime = 0., proccpu = 0.;
380 numev = status->
GetEntries() - slstat->GetEntriesProcessed();
381 progress = slstat->AddProcessed(status);
386 totev = status->GetEntries();
392 Error(
"GetNextPacket",
"no status came in the kPROOF_GETPACKET message");
395 (*r) >> latency >> proctime >> proccpu;
398 if (
r->BufferSize() >
r->Length()) (*r) >> bytesRead;
399 if (
r->BufferSize() >
r->Length()) (*r) >> totalEntries;
400 if (
r->BufferSize() >
r->Length()) (*r) >> totev;
402 numev = totev - slstat->GetEntriesProcessed();
403 slstat->GetProgressStatus()->IncEntries(numev);
404 slstat->GetProgressStatus()->SetLastUpdate();
413 Info(
"GetNextPacket",
"worker-%s (%s): %lld %7.3lf %7.3lf %7.3lf %lld",
415 numev, latency, proctime, proccpu, bytesRead);
419 latency, proctime, proccpu, bytesRead);
424 Info(
"GetNextPacket",
"worker-%s (%s) is done (%lld cycles)",
438 Error(
"GetNextPacket",
"problems assigning additional work: stop");
462 if (slstat->fCircNtp->GetEntries() <= 0) {
466 if (num < 1) num = (avg >= 1) ? avg : 1;
468 Info(
"GetNextPacket",
"calibration: total entries %lld, workers %d, frac: %.1f %%, raw num: %lld",
472 slstat->UpdatePerformance(0.);
482 slstat->UpdatePerformance(proctime);
494 TSlaveStat *wrkStat = 0;
496 while ((tmpWrk = (
TSlave *)nxwrk())) {
498 if (wrkStat->fRate > 0) {
500 sumRate += wrkStat->fRate;
503 Info(
"GetNextPacket",
"%d: worker-%s: rate %lf /s (sum: %lf /s)",
504 nrm, tmpWrk->
GetOrdinal(), wrkStat->fRate, sumRate);
506 Warning(
"GetNextPacket",
"dynamic_cast<TSlaveStat *> failing on value for '%s (%s)'! Skipping",
513 Error(
"GetNextPacket",
"no worker has consistent information: stop processing!");
519 if (nrm < fWrkStats->GetSize()) {
524 Info(
"GetNextPacket",
"rate: avg: %lf /s/wrk - sum: %lf /s (measurements %d out of %d)",
528 Double_t wrkRate = (slstat->fRate > 0.) ? slstat->fRate : avgRate ;
531 Info(
"GetNextPacket",
"worker-%s (%s): raw packet size: %lld", sl->
GetOrdinal(), sl->
GetName(), num);
539 Info(
"GetNextPacket",
"worker-%s (%s): time-limited packet size: %lld (upper limit: %.2f secs)",
545 Info(
"GetNextPacket",
"worker-%s (%s): time-limited packet size: %lld (lower limit: %.2f secs)",
552 if (num > 1 && slstat->fRate > 0 && num / slstat->fRate >
fMaxPacketTime) {
558 num = (num > 1) ? num : 1;
565 slstat->fTimeInstant = cTime;
572 Info(
"GetNextPacket",
"worker-%s: num %lld, processing %lld, remaining %lld",sl->
GetOrdinal(),
589 Error(
"AddWorkers",
"Null list of new workers!");
597 while (( sl =
dynamic_cast<TSlave*
>(next()) ))
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
R__EXTERN TProofServ * gProofServ
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Manages an element of a TDSet.
This class implements a data set to be used for PROOF processing.
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
void DeleteValues()
Remove all (key,value) pairs from the map AND delete the values when they are allocated on the heap.
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
A simple TTree restricted to a list of double variables only.
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
This packetizer generates packets of generic units, representing the number of times an operation cyc...
Int_t AddWorkers(TList *workers)
Adds new workers. Returns the number of workers added, or -1 on failure.
virtual ~TPacketizerUnit()
Destructor.
Double_t GetCurrentTime()
Get current time.
Float_t GetCurrentRate(Bool_t &all)
Get Estimation of the current rate; just summing the current rates of the active workers.
TDSetElement * GetNextPacket(TSlave *sl, TMessage *r)
Get next packet.
Int_t AssignWork(TDSet *, Long64_t, Long64_t num)
Assign work to be done to this packetizer.
Named parameter, streamable and storable.
void SetVal(const AParamType &val)
Container class for processing statistics.
void SetLastUpdate(Double_t updtTime=0)
Update time stamp either with the passed value (if > 0) or with the current time.
Double_t GetProcTime() const
Long64_t GetEntries() const
void SetLastEntries(Long64_t entries)
Double_t GetCPUTime() const
void IncEntries(Long64_t entries=1)
Long64_t GetBytesRead() const
TDSetElement * GetNextPacket(Long64_t totalEntries=-1)
Get next range of entries to be processed on this server.
Bool_t IsTopMaster() const
TObject * GetParameter(const char *par) const
Get specified parameter.
Class describing a PROOF worker server.
Int_t GetParallel() const
Int_t GetProtocol() const
const char * GetName() const
Returns name of object.
const char * GetOrdinal() const
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Continue()
Resume a stopped stopwatch.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
virtual TProofProgressStatus * AddProcessed(TProofProgressStatus *st)=0
The packetizer is a load balancing object created for each query.
TProofProgressStatus * fProgressStatus
virtual Bool_t HandleTimer(TTimer *timer)
Send progress message to client.
virtual Int_t AddProcessed(TSlave *, TProofProgressStatus *, Double_t, TList **)
Long64_t GetEntriesProcessed() const