示例#1
0
        internal override void Initialize()
        {
            if (KernelControllerObject != null)
            {
                //  Already initialized

                return;
            }

            base.Initialize();
            ProcessContext.Initialize();

            GeneralPurposeStorage = EventingStorage.CreateLocalStorage(QualityOfService.RecyclableEvents,
                                                                       BUFFER_EXPANSION_SIZE);

            KernelControllerObject = this;
        }
示例#2
0
        public static SystemAllocationLogger Create(string sourceName)
        {
            EventingStorage storage = EventingStorage.CreateLocalStorage(QualityOfService.RecyclableEvents,
                                                                         DefaultLogSize);

            if (storage == null)
            {
                return(null);
            }

            SystemAllocationLogger Logger = new SystemAllocationLogger(sourceName,
                                                                       storage,
                                                                       ENABLE_ALL_MASK);

            if (Logger != null)
            {
                Logger.Register();
            }

            return(Logger);
        }
示例#3
0
        public static ProcessorLogger Create(string sourceName)
        {
            EventingStorage storage = EventingStorage.CreateLocalStorage(QualityOfService.RecyclableEvents,
                                                                         DefaultProcessorLogSize);

            if (storage == null)
            {
                return(null);
            }

            ProcessorLogger Logger = new ProcessorLogger(sourceName,
                                                         storage,
                                                         CAPTURE_STACK_TRACE | ENABLE_ALL_MASK);

            if (Logger != null)
            {
                Logger.Register();
            }

            return(Logger);
        }
示例#4
0
        public static SamplingProfiler Create(string sourceName, int maxStackSize, uint storageSize)
        {
            EventingStorage storage = EventingStorage.CreateLocalStorage(QualityOfService.RecyclableEvents,
                                                                         storageSize);

            if (storage == null)
            {
                return(null);
            }

            SamplingProfiler Logger = new SamplingProfiler(sourceName,
                                                           maxStackSize,
                                                           storage,
                                                           ENABLE_ALL_MASK);

            if (Logger != null)
            {
                Logger.Register();
            }

            return(Logger);
        }
示例#5
0
        //  Public methods

        //  Private methods

        internal override void Initialize()
        {
            base.Initialize();

            EventTable         = new Hashtable();
            SourcesLookupTable = new Hashtable();
            SourcesHandleTable = new Hashtable();

            UIntPtr RepositoryStorageHandle = FetchLocalStorage();

            if (RepositoryStorageHandle != 0)
            {
                TypesRepository = EventingStorage.CreateStorageFromHandle(RepositoryStorageHandle);

                //  Fetch now the existing source list created before initializing the controller

                int        currentSize = 20;
                UIntPtr [] sourceArray = new UIntPtr[currentSize];

                if (sourceArray != null)
                {
                    unsafe
                    {
                        fixed(UIntPtr *ptr = sourceArray)
                        {
                            int sourceCount = QuerySystemSources(ptr, (ushort)currentSize);

                            while (sourceCount > currentSize)
                            {
                                sourceArray = new UIntPtr[sourceCount];
                                sourceCount = QuerySystemSources(ptr, (ushort)currentSize);
                            }

                            for (int i = 0; i < sourceCount; i++)
                            {
                                UIntPtr sourceHandle  = sourceArray[i];
                                UIntPtr storageHandle = 0;
                                string  bufferName    = "";

                                if (GetNativeSourceName(sourceHandle, ref storageHandle, ref bufferName))
                                {
                                    EventSource source = new EventSource(this, bufferName, storageHandle);

                                    if (source != null)
                                    {
                                        source.Register();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                TypesRepository = EventingStorage.CreateLocalStorage(QualityOfService.PermanentEvents,
                                                                     BUFFER_EXPANSION_SIZE);
                SetRepositoryStorage(TypesRepository.GetHandle());
            }

            string sourceName = "ControllerLog";

#if SINGULARITY_KERNEL
            sourceName = sourceName + "{kernel}";
#else
            unsafe {
                int    argMaxLen = ProcessService.GetStartupArg(0, null, 0);
                char[] argArray  = new char [argMaxLen];


                fixed(char *argptr = &argArray[0])
                {
                    int len = ProcessService.GetStartupArg(0,
                                                           argptr,
                                                           argArray.Length);

                    sourceName = sourceName + "{" + String.StringCTOR(argptr, 0, len) + "}";
                    sourceName = sourceName + "(PID:" + ProcessService.GetCurrentProcessId() + ")";
                }
            }
#endif

            InternalSource = ControllerLogger.Create(sourceName, TypesRepository);
        }