/* Web Polygraph http://www.web-polygraph.org/
* (C) 2003-2006 The Measurement Factory
* Licensed under the Apache License, Version 2.0 */
#include "base/polygraph.h"
#include "runtime/LogComment.h"
#include "runtime/polyBcastChannels.h"
#include "runtime/PubWorld.h"
#include "client/PrivWorld.h"
#include "client/Client.h"
#include "client/WssFreezer.h"
int WssFreezer::TheStartCount = 0;
void WssFreezer::start() {
Assert(!TheStartCount); // multiple wss freezers are not supported
TheStartCount++;
startFill();
}
void WssFreezer::startFill() {
printGoal(Comment(5) << "fyi: working set size goal: ");
Comment << endc;
if (PrivWorld::Frozen() && PubWorld::Frozen()) {
Comment(5) << "warning: working set is already frozen" << endc;
Client::ReportWss(5);
} else {
Broadcast(TheInfoChannel, BcastRcver::ieWssFill);
}
}
void WssFreezer::startFreeze() {
Comment(5) << "fyi: started freezing working set size" << endc;
PubWorld::FreezeWss();
Broadcast(TheInfoChannel, BcastRcver::ieWssFreeze);
// todo: wait and report this condition if it does not happen immediatelly
if (PrivWorld::Frozen() && PubWorld::Frozen())
Comment(5) << "fyi: working set size is now frozen" << endc;
}
syntax highlighted by Code2HTML, v. 0.9.1