FIXME: this needs to be rewritten in order to remove dependencies on formerly run unit tests
| 991 | |
| 992 | ///FIXME: this needs to be rewritten in order to remove dependencies on formerly run unit tests |
| 993 | void TestDUChain::testImportCache() |
| 994 | { |
| 995 | KDevelop::globalItemRepositoryRegistry().printAllStatistics(); |
| 996 | |
| 997 | KDevelop::RecursiveImportRepository::repository()->printStatistics(); |
| 998 | |
| 999 | //Analyze the whole existing import-cache |
| 1000 | //This is very expensive, since it involves loading all existing top-contexts |
| 1001 | uint topContextCount = DUChain::self()->newTopContextIndex(); |
| 1002 | |
| 1003 | uint analyzedCount = 0; |
| 1004 | uint totalImportCount = 0; |
| 1005 | uint naiveNodeCount = 0; |
| 1006 | QSet<uint> reachableNodes; |
| 1007 | |
| 1008 | DUChainReadLocker lock(DUChain::lock()); |
| 1009 | for (uint a = 0; a < topContextCount; ++a) { |
| 1010 | if (a % qMax(1u, topContextCount / 100) == 0) { |
| 1011 | qDebug() << "progress:" << (a * 100) / topContextCount; |
| 1012 | } |
| 1013 | TopDUContext* context = DUChain::self()->chainForIndex(a); |
| 1014 | if (context) { |
| 1015 | TopDUContext::IndexedRecursiveImports imports = context->recursiveImportIndices(); |
| 1016 | ++analyzedCount; |
| 1017 | totalImportCount += imports.set().count(); |
| 1018 | collectReachableNodes(reachableNodes, imports.setIndex()); |
| 1019 | naiveNodeCount += collectNaiveNodeCount(imports.setIndex()); |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | QVERIFY(analyzedCount); |
| 1024 | qDebug() << "average total count of imports:" << totalImportCount / analyzedCount; |
| 1025 | qDebug() << "count of reachable nodes:" << reachableNodes.size(); |
| 1026 | qDebug() << "naive node-count:" << naiveNodeCount << "sharing compression factor:" << |
| 1027 | (( float )reachableNodes.size()) / (( float )naiveNodeCount); |
| 1028 | } |
| 1029 | |
| 1030 | #endif |
| 1031 |
nothing calls this directly
no test coverage detected