* Show evaluation stats when NIX_SHOW_STATS=1.
This commit is contained in:
		
							parent
							
								
									0832956089
								
							
						
					
					
						commit
						310e605995
					
				
					 3 changed files with 30 additions and 15 deletions
				
			
		|  | @ -527,9 +527,12 @@ extern "C" { | ||||||
| 
 | 
 | ||||||
| void printEvalStats(EvalState & state) | void printEvalStats(EvalState & state) | ||||||
| { | { | ||||||
|     printMsg(lvlInfo, |     bool showStats = getEnv("NIX_SHOW_STATS", "0") != "0"; | ||||||
|  |     printMsg(showStats ? lvlInfo : lvlDebug, | ||||||
|         format("evaluated %1% expressions, %2% cache hits, %3%%% efficiency, used %4% ATerm bytes") |         format("evaluated %1% expressions, %2% cache hits, %3%%% efficiency, used %4% ATerm bytes") | ||||||
|         % state.nrEvaluated % state.nrCached |         % state.nrEvaluated % state.nrCached | ||||||
|         % ((float) state.nrCached / (float) state.nrEvaluated * 100) |         % ((float) state.nrCached / (float) state.nrEvaluated * 100) | ||||||
|         % AT_calcAllocatedSize()); |         % AT_calcAllocatedSize()); | ||||||
|  |     if (showStats) | ||||||
|  |         printATermMapStats(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -213,6 +213,27 @@ unsigned int ATermMap::size() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | #include <iostream> | ||||||
|  | 
 | ||||||
|  | void printATermMapStats() | ||||||
|  | { | ||||||
|  |     cout << "RESIZES: " << nrResizes << " " | ||||||
|  |          << sizeTotalAlloc << " " | ||||||
|  |          << sizeCurAlloc << " " | ||||||
|  |          << sizeMaxAlloc << endl; | ||||||
|  |          | ||||||
|  |     cout << "SET: " | ||||||
|  |          << nrItemsSet << " " | ||||||
|  |          << nrSetProbes << " " | ||||||
|  |          << (double) nrSetProbes / nrItemsSet << endl; | ||||||
|  | 
 | ||||||
|  |     cout << "GET: " | ||||||
|  |          << nrItemsGet << " " | ||||||
|  |          << nrGetProbes << " " | ||||||
|  |          << (double) nrGetProbes / nrItemsGet << endl; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| #if 0 | #if 0 | ||||||
| int main(int argc, char * * argv) | int main(int argc, char * * argv) | ||||||
| { | { | ||||||
|  | @ -294,19 +315,6 @@ int main(int argc, char * * argv) | ||||||
|          |          | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     cout << "RESIZES: " << nrResizes << " " |     printATermMapStats(); | ||||||
|          << sizeTotalAlloc << " " |  | ||||||
|          << sizeCurAlloc << " " |  | ||||||
|          << sizeMaxAlloc << endl; |  | ||||||
|          |  | ||||||
|     cout << "SET: " |  | ||||||
|          << nrItemsSet << " " |  | ||||||
|          << nrSetProbes << " " |  | ||||||
|          << (double) nrSetProbes / nrItemsSet << endl; |  | ||||||
| 
 |  | ||||||
|     cout << "GET: " |  | ||||||
|          << nrItemsGet << " " |  | ||||||
|          << nrGetProbes << " " |  | ||||||
|          << (double) nrGetProbes / nrItemsGet << endl; |  | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -111,4 +111,8 @@ private: | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | /* Hack. */ | ||||||
|  | void printATermMapStats(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| #endif /* !__ATERM_MAP_H */ | #endif /* !__ATERM_MAP_H */ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue