From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

dougcn 在 21 Jun 2008 创建
最后由 hamishwillee 在 15 Dec 2011 编辑


Heaplogger 第一版



	/**This function will go at the start of your app. It will give a config line line like
* This is the Heap Logger Dump.
* Old heap contains 000000 bytes in 000000 cells.
* If there are any cells already allocated, the old heap should be switched back
* in with User::SwitchHeap() before these cells are freed.
* @param aFileName is the name of the log file created
* @return the old RHeap.

IMPORT_C static RHeap* HeapLogger::UseHeapLogger(const TDesC& aFileName);
/**This sets what will actually be logged. Defaults to ELogNothing
* @param aMode is an ored combination of THeapLoggerMode

IMPORT_C static void HeapLogger::SetMode(TInt aMode);
/**When content is logged (on Free or a heap dump) this is the max
* length of the buffer to be logged.
* @param aMaxLen the max length to log.*/

IMPORT_C static void HeapLogger::SetMaxContentLength(TInt aMaxLen);
/**This dumps the current heap into the log file.*/
IMPORT_C static void HeapLogger::DumpHeap();
/**This allows you to put tags in the log file so that you can tie the
* allocations to sections of code.
* @param aLogStr is a tag for your code to annotate the log.
* @param this is the file, normally given by "__FILE__"
* @param this is the lin number in the source file. Given by "__LINE__"*/

IMPORT_C static void HeapLogger::Log(const TDesC8& aLogStr, const char* aFile, TInt aLine);


欲用heaplogger,只需在mmp file包含头文件和静态库文件,然后调用上述函数。可以在下面地址下载一个Hello world例子:


Lumberjack只是使用这个日志工具记录一些随机的东西。库文件和头文件已包括其中。库文件是针对Series 60 3rd MR编译的,但在其他Symbian OS V.9平台下也应该可以工作。



我的确碰到过一些有关使用它和carbide中目标设备调试方面的问题,但那已经过去了。 有任何意见,可张贴在这里。

Internal links

This page was last modified on 15 December 2011, at 08:39.
43 page views in the last 30 days.