// template for static creation method
        new public static EachSourceClass Create(string sourcename,
                                                 uint size,
                                                 uint storageOptions,
                                                 uint sourceFlags)
        {
            EventingStorage storage = EventingStorage.CreateLocalStorage(storageOptions,
                                                                         size);

            if (storage == null)
            {
                DebugStub.WriteLine("Failure to create local storage " + sourcename);
                DebugStub.Break();
                return(null);
            }

            EachSourceClass Source = new EachSourceClass_Impl(sourcename,
                                                              storage,
                                                              sourceFlags);

            if (Source != null)
            {
                if (!Source.Register())
                {
                    DebugStub.WriteLine("Error initializing the source " + sourcename);
                    return(null);
                }
            }

            return(Source);
        }
Exemple #2
0
            public static GCEventSource Create(string sourceName, uint typeSize, ulong options)
            {
                uint qos = QualityOfService.RecyclableEvents;

                if (options != 0)
                {
                    qos |= QualityOfService.OOM_BreakOnRecycle;
                }

                EventingStorage storage = EventingStorage.CreateLocalStorage(qos, typeSize);

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

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

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

                return(Logger);
            }
Exemple #3
0
        /// <summary>
        /// Create and Register a TcpSessionEventsSource.
        /// </summary>
        /// <devdoc>
        /// This should be a Generic when supported.  Or use more of the base class (Static?)  // BUGBUG AM (later?)
        /// </devdoc>
        public static TcpSessionEventsSource Create(string sourceName,
                                                    uint size,
                                                    uint storageOptions,   // BUGBUG AM: [Flags] enum
                                                    uint sourceFlags,
                                                    uint debugFlags)
        {
            TcpSessionEventsSource tcpSessionEventsSource = null;

            EventingStorage eventStorage =
                EventingStorage.CreateLocalStorage(storageOptions, size);

            if (eventStorage == null)
            {
                DebugStub.WriteLine("Failure to obtain storage for TcpSessionEvents");
                DebugStub.Break();
            }
            else
            {
                tcpSessionEventsSource =
                    new TcpSessionEventsSource(sourceName, eventStorage, sourceFlags, debugFlags);
                if (tcpSessionEventsSource == null)
                {
                    // TODO: Is EventStorage returned here and below if failures occur?
                    DebugStub.WriteLine("Failure to construct TcpSessionEventsSource instance.");
                    DebugStub.Break();
                }
                else
                {
                    bool registerSucceeded = tcpSessionEventsSource.Register();
                    if (registerSucceeded == false)
                    {
                        tcpSessionEventsSource = null;
                        DebugStub.WriteLine("Failure to register TcpSessionEventsSource.");
                        DebugStub.Break();
                    }
                }
            }

            return(tcpSessionEventsSource);
        }