Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\nkern\nk_trace.h
16 // WARNING: This file contains some APIs which are internal and are subject
17 // to change without notice. Such APIs should therefore not be used
18 // outside the Kernel and Hardware Services package.
27 #define DEBUGPRINT KPrintf
33 #define DEBUGMASK (KDebugMask())
34 #define DEBUGNUM(x) (KDebugNum(x))
36 GLREF_C void KPrintf(const char*,...);
42 IMPORT_C TInt KDebugMask();
43 IMPORT_C TBool KDebugNum(TInt aBitNum);
51 // __KTRACE_MASK only supports the first 32 debug trace bits
52 #define __KTRACE_MASK(a,p) {if((DEBUGMASK&(a)))p;}
53 #define __KTRACE_OPT(a,p) {if((DEBUGNUM(a)))p;}
54 #define __KTRACE_OPT2(a,b,p) {if( (DEBUGNUM(a)) || (DEBUGNUM(b)) )p;}
60 // __KTRACE_ALL only supports the first 32 debug trace bits
61 #define __KTRACE_ALL(a,p) {if((DEBUGMASK&(a))==(a))p;}
67 #define KHARDWARE 0 //0x00000001
73 #define KBOOT 1 //0x00000002
79 #define KSERVER 2 //0x00000004
85 #define KMMU 3 //0x00000008
91 #define KSEMAPHORE 4 //0x00000010
97 #define KSCHED 5 //0x00000020
103 #define KPROC 6 //0x00000040
109 #define KEXEC 7 //0x00000080
115 #define KDEBUGGER 8 //0x00000100 // for kernel-side debug agents
121 #define KTHREAD 9 //0x00000200
127 #define KDLL 10 //0x00000400
133 #define KIPC 11 //0x00000800
139 #define KPBUS1 12 //0x00001000
145 #define KPBUS2 13 //0x00002000
151 #define KPBUSDRV 14 //0x00004000
157 #define KPOWER 15 //0x00008000
163 #define KTIMING 16 //0x00010000
169 #define KEVENT 17 //0x00020000
175 #define KOBJECT 18 //0x00040000
181 #define KDFC 19 //0x00080000
187 #define KEXTENSION 20 //0x00100000
193 #define KSCHED2 21 //0x00200000
199 #define KLOCDRV 22 //0x00400000
205 #define KFAIL 23 //0x00800000
211 #define KTHREAD2 24 //0x01000000
217 #define KDEVICE 25 //0x02000000
223 #define KMEMTRACE 26 //0x04000000
229 #define KDMA 27 //0x08000000
235 #define KMMU2 28 //0x10000000
241 #define KNKERN 29 //0x20000000
247 #define KSCRATCH 30 //0x40000000 // reserved for temporary debugging
253 #define KPANIC 31 //0x80000000
259 #define KUSB 32 //0x00000001, index 1
265 #define KUSBPSL 33 //0x00000002, index 1
271 #define KNETWORK1 34 //0x00000004, index 1
277 #define KNETWORK2 35 //0x00000008, index 1
283 #define KSOUND1 36 //0x00000010, index 1
289 #define KUSBHOST 37 //0x00000020, index 1
295 #define KUSBOTG 38 //0x00000040, index 1
301 #define KUSBJOURNAL 39 //0x00000080, index 1
307 #define KUSBHO 40 //0x00000100, index 1
313 #define KRESMANAGER 41 //0x00000200, index 1
319 #define KIIC 42 //0x00000400, index 1
325 #define KHCR 43 //0x00000800, index 1
331 #define KREALTIME 63 //0x80000000, index 1
337 #define KPAGING 62 //0x40000000, index 1
343 #define KLOCDPAGING 61 //0x20000000, index 1
349 #define KDATAPAGEWARN 60 //0x10000000, index 1
355 #define KPCI 59 //0x08000000, index 1
361 #define KPIPE 58 //0x04000000, index 1
363 // RESERVED: Trace bits 192 - 255 are reserved for licensee partners
370 #define KALWAYS -1 //0xffffffff
371 #define KMAXTRACE (KNumTraceMaskWords*32-1) // the maximum debug trace bit
373 #define __KTRACE_OPT(a,p)
374 #define __KTRACE_ALL(a,p)
375 #define __KTRACE_OPT2(a,b,p)
377 #define KMAXTRACE (KNumTraceMaskWords*32-1)
385 #define DEBUGMASKWORD2 2
388 words 0 & 1 of debug mask should be used for kernel debugging
389 word 2 of debug mask should be used to configure the ways the kernel behaves
390 word 3 of debug mask should be used to configure the ways the user library behaves
391 words 4 & 5 of debug mask should be used for file system debugging
392 words 6 & 7 of debug mask are reserved for licensees
399 #define KALLTHREADSSYSTEM 64 //0x00000001, index 2
402 Suppresses console output (in EWSRV) for faster automated tests.
406 #define KTESTFAST 65 //0x00000002, index 2
409 Suppresses anything which might disturb latency testing,
410 for example platsec diagnostics emitted with the system lock held.
414 #define KTESTLATENCY 66 //0x00000004, index 2
417 When a crash occurs this flag determines whether the debugger executes.
418 If set the crash debugger will NOT operate (even if it's in rom).
419 If clear the crash debugger will run.
423 #define KDEBUGMONITORDISABLE 67 //0x00000008, index 2
426 When a crash occurs this flag determines whether the logger executes.
427 If set the crash logger will NOT operate (even if it's in rom).
428 If clear the crash logger will run.
432 #define KCRASHLOGGERDISABLE 68 //0x00000010, index 2
435 Delay scheduling of newly unblocked threads until the next timer tick
436 occurs, to check for thread priority dependencies. Part of the crazy
437 scheduler functionality.
441 #define KCRAZYSCHEDDELAY 69 //0x00000020, index 2
445 /* Word 3 of debug mask : configures user library behaviour */
451 #define KUSERHEAPTRACE 96 //0x00000001, index 3
461 #define __KTRACE_FAIL(r,p) {if ((r)!=KErrNone && (DEBUGNUM(KFAIL))) p;}
464 #define __KTRACE_FAIL(r,p)
467 #include <e32btrace.h>
469 #ifdef __KERNEL_MODE__
472 class DBTraceFilter2;
480 BTrace::THandler iHandler;
481 BTrace::TControlFunction iControl;
482 DBTraceFilter2*volatile iFilter2;
484 TBool CheckFilter2(TUint32 aUid);
490 extern SBTraceData BTraceData;
492 #if defined(_DEBUG) || defined(BTRACE_KERNEL_ALL)
494 #undef BTRACE_THREAD_IDENTIFICATION
495 #undef BTRACE_CPU_USAGE
497 #undef BTRACE_CODESEGS
499 #undef BTRACE_PAGING_MEDIA
500 #undef BTRACE_KERNEL_MEMORY
501 #undef BTRACE_RAM_ALLOCATOR
502 #undef BTRACE_FAST_MUTEX
503 #undef BTRACE_RESOURCE_MANAGER
504 #undef BTRACE_RESMANUS
505 #undef BTRACE_TRAWEVENT
506 #undef BTRACE_SYMBIAN_KERNEL_SYNC
507 #undef BTRACE_FLEXIBLE_MEM_MODEL
508 #undef BTRACE_CLIENT_SERVER
509 #undef BTRACE_REQUESTS
513 If defined, code for BTrace category BTrace::EThreadIdentification
514 is compiled into the kernel.
518 #define BTRACE_THREAD_IDENTIFICATION
521 If defined, code for BTrace category BTrace::ECpuUsage
522 is compiled into the kernel.
526 #define BTRACE_CPU_USAGE
529 If defined, code for BTrace category BTrace::EChunks is compiled into the
534 #define BTRACE_CHUNKS
537 If defined, code for BTrace category BTrace::ECodeSegs is compiled into the
542 #define BTRACE_CODESEGS
545 If defined, code for BTrace category BTrace::EPaging is compiled into the
550 #define BTRACE_PAGING
553 If defined, code for BTrace category BTrace::EPagingMedia is compiled into the
554 Local Media Subsystem and relevant paging media drivers.
558 #define BTRACE_PAGING_MEDIA
561 If defined, code for BTrace category BTrace::EKernelMemory is compiled into the
566 #define BTRACE_KERNEL_MEMORY
569 If defined, code for BTrace category BTrace::ERamAllocator is compiled into the
572 This BTrace category is only supported on the multiple and moving memory models.
577 #if defined(__MEMMODEL_MOVING__) || defined (__MEMMODEL_MULTIPLE__)
578 #define BTRACE_RAM_ALLOCATOR
582 If defined, code for BTrace category BTrace::EFastMutex is compiled into the
585 #define BTRACE_FAST_MUTEX
588 If defined, code for BTrace category BTrace::EResourceManager is compiled into the
589 Resource Manager Subsystem.
593 #define BTRACE_RESOURCE_MANAGER
596 If defined, code for BTrace category BTrace::EResourceManagerUs is compiled into the
597 Resource Manager Subsystem's User-Side API.
601 #define BTRACE_RESMANUS
604 If defined, code for BTrace category BTrace::ERawEvent is compiled into the
609 #define BTRACE_TRAWEVENT
612 If defined, code for BTrace category BTrace::ESymbianKernelSync is compiled into
615 #define BTRACE_SYMBIAN_KERNEL_SYNC
618 If defined, code for BTrace category BTrace::EFlexibleMemModel is compiled into
621 This BTrace category is only supported on the flexible memory model.
623 #define BTRACE_FLEXIBLE_MEM_MODEL
626 If defined, code for BTrace category BTrace::EIic is compiled into the
632 If defined, code for BTrace category BTrace::EClientServer is compiled into the
635 #define BTRACE_CLIENT_SERVER
638 If defined, code for BTrace category BTrace::ERequest is compiled into the
641 #define BTRACE_REQUESTS
645 #endif // __KERNEL_MODE__
648 #if defined(BTRACE_KERNEL_PROTOTYPE)
649 // Prototype trace categories...
650 #undef BTRACE_THREAD_PRIORITY
651 #define BTRACE_THREAD_PRIORITY
654 #if defined(BTRACE_KERNEL_VERBOSE)
655 // Verbose trace options
659 If defined, verbose code for BTrace category BTrace::EPaging is compiled into the
664 #define BTRACE_PAGING_VERBOSE
667 #endif //BTRACE_KERNEL_VERBOSE
669 #if defined(_DEBUG) && !defined(__SMP__)
673 TInt KCrazySchedulerEnabled();