本文整理汇总了C++中timer::reportTotal方法的典型用法代码示例。如果您正苦于以下问题:C++ timer::reportTotal方法的具体用法?C++ timer::reportTotal怎么用?C++ timer::reportTotal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timer
的用法示例。
在下文中一共展示了timer::reportTotal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compute
void Compute(graph<vertex>& GA, commandLine P) {
t1.start();
long start = P.getOptionLongValue("-r",0);
if(GA.V[start].getOutDegree() == 0) {
cout << "starting vertex has degree 0" << endl;
return;
}
const uintE K = P.getOptionIntValue("-K",10);
const uintE N = P.getOptionIntValue("-N",10);
const double t = P.getOptionDoubleValue("-t",3);
srand (time(NULL));
uintE seed = rand();
const intE n = GA.n;
//walk length probabilities
double* fact = newA(double,K);
fact[0] = 1;
for(long k=1;k<K;k++) fact[k] = k*fact[k-1];
double* probs = newA(double,K);
for(long k=0;k<K;k++) probs[k] = exp(-t)*pow(t,k)/fact[k];
unordered_map<uintE,double> p;
for(long i=0;i<N;i++) {
double randDouble = (double) hashInt(seed++) / UINT_E_MAX;
long j = 0;
double mass = 0;
uintE x = start;
do {
mass += probs[j];
if(randDouble < mass) break;
x = walk(x,GA.V,seed++);
j++;
} while(j <= K);
p[x]++;
}
for(auto it=p.begin();it!=p.end();it++) {
p[it->first] /= N;
}
free(probs); free(fact);
t1.stop();
pairIF* A = newA(pairIF,p.size());
long numNonzerosQ = 0;
for(auto it = p.begin(); it != p.end(); it++) {
A[numNonzerosQ++] = make_pair(it->first,it->second);
}
sweepObject sweep = sweepCut(GA,A,numNonzerosQ,start);
free(A);
cout << "number of vertices touched = " << p.size() << endl;
cout << "number of edges touched = " << sweep.vol << endl;
cout << "conductance = " << sweep.conductance << " |S| = " << sweep.sizeS << " vol(S) = " << sweep.volS << " edgesCrossing = " << sweep.edgesCrossing << endl;
t1.reportTotal("computation time");
}
示例2: reportAll
void reportAll() {
t0.reportTotal("preprocess");
t1.reportTotal("connected components");
t2.reportTotal("Ecc phase 1");
t3.reportTotal("sort by decreasing eccentricities");
t4.reportTotal("Ecc phase 2");
t5.reportTotal("total time excluding writing to file");
}
示例3: reportAll
void reportAll() {
t0.reportTotal("preprocess");
t1.reportTotal("connected components");
t2.reportTotal("random sampling");
t3.reportTotal("BFS from sample");
t4.reportTotal("compute max distances");
t5.reportTotal("find furthest vertex w");
t6.reportTotal("BFS from w");
t7.reportTotal("BFS from Ngh_S");
t8.reportTotal("compute estimates");
t9.reportTotal("main loop");
t10.reportTotal("total time excluding writing to file");
}