0002-Filter-out-unused-instance-counters-in-debug.patch

Filter out unused instance counters in debug; patch by int-e - Spex, 02/24/2009 11:23 pm

Download (3.4 kB)

b/nel/include/nel/misc/debug.h
675 675
	sint32		_InstanceCounter;
676 676
	sint32		_DeltaCounter;
677 677
	const char	*_ClassName;
678
	bool		_Touched;
678 679

679 680
	TInstanceCounterData(const char *className);
680 681

......
819 820
		className##InstanceCounter() \
820 821
		{ \
821 822
			_InstanceCounterData._InstanceCounter++; \
823
			_InstanceCounterData._Touched = true; \
822 824
		} \
823 825
		className##InstanceCounter(const className##InstanceCounter &/* other */) \
824 826
		{ \
825 827
			_InstanceCounterData._InstanceCounter++; \
828
			_InstanceCounterData._Touched = true; \
826 829
		} \
827 830
		\
828 831
		~className##InstanceCounter()\
b/nel/src/misc/debug.cpp
1246 1246
TInstanceCounterData::TInstanceCounterData(const char *className)
1247 1247
:	_InstanceCounter(0),
1248 1248
	_DeltaCounter(0),
1249
	_ClassName(className)
1249
	_ClassName(className),
1250
	_Touched(false)
1250 1251
{
1251 1252
	CInstanceCounterLocalManager::getInstance().registerInstanceCounter(this);
1252 1253
}
......
1285 1286
				{
1286 1287
					const TInstanceCounterData *icd = *first;
1287 1288

1289
					if (!icd->_Touched)
1290
						break;
1291

1288 1292
					if( counters.find(icd->_ClassName) == counters.end())
1289 1293
					{
1290 1294
						// insert a new item
b/nel/tools/nel_unit_test/ut_misc_debug.h
202 202

203 203
		}
204 204

205
		// FIXME: This is brittle - the precise list of counters depends on how much of
206
		// NeL gets linked with the unit tests. The order is also mostly unpredictable
207
		// with Unix shared objects.
208
#ifdef NL_OS_UNIX
209
		string ref = "Listing 6 Instance counters :\n"
210
#else
211
		string ref = "Listing 5 Instance counters :\n"
212
#endif // NL_OS_UNIX
205
		string ref = "Listing 3 Instance counters :\n"
213 206
					 "  Class 'CFoo1               ', \t        10 instances, \t        10 delta\n"
214 207
					 "  Class 'CFoo2               ', \t        20 instances, \t        20 delta\n"
215
					 "  Class 'CFoo3               ', \t        10 instances, \t        10 delta\n"
216
					 "  Class 'CSafeSingleton      ', \t         0 instances, \t         0 delta\n"
217
					 "  Class 'CUnsafeSingleton    ', \t         0 instances, \t         0 delta\n"
218
#ifdef NL_OS_UNIX
219
					 "  Class 'CWordsDictionary    ', \t         0 instances, \t         0 delta\n"
220
#endif // NL_OS_UNIX
221
					 "";
208
					 "  Class 'CFoo3               ', \t        10 instances, \t        10 delta\n";
222 209

223 210
		string ret = NLMISC::CInstanceCounterManager::getInstance().displayCounters();
224 211

225
-