Uses Tx.Windows implementation of Etw log parser and converts the objects into BinaryEnvelope objects. Use a BinaryConfigTypeMap derived implementation along with this class to convert into required datatypes.
Example #1
0
        /// <summary>Notifies the provider that an observer is to receive notifications.</summary>
        /// <returns>A reference to an interface that allows observers to stop receiving notifications before the provider has finished sending them.</returns>
        /// <param name="observer">The object that is to receive notifications.</param>
        /// <exception cref="System.ArgumentNullException">observer is null.</exception>
        public IDisposable Subscribe(IObserver <IEnvelope> observer)
        {
            if (observer == null)
            {
                throw new ArgumentNullException("observer");
            }

            this.ValidateConfiguration();

            var flattenFiles = this.files
                               .SelectMany(PathUtils.FlattenIfNeeded)
                               .ToArray();

            if (flattenFiles.Length == 0)
            {
                return(Observable.Empty <IEnvelope>()
                       .SubscribeSafe(observer));
            }

            IObservable <IEnvelope> observable;

            if (this.useSequentialReader)
            {
                if (this.startTime.HasValue)
                {
                    observable = BinaryEtwObservable.FromSequentialFiles(
                        this.startTime.Value,
                        this.endTime.Value,
                        flattenFiles);
                }
                else
                {
                    observable = BinaryEtwObservable.FromSequentialFiles(flattenFiles);
                }
            }
            else
            {
                if (this.startTime.HasValue)
                {
                    observable = BinaryEtwObservable.FromFiles(
                        this.startTime.Value,
                        this.endTime.Value,
                        flattenFiles);
                }
                else
                {
                    observable = BinaryEtwObservable.FromFiles(flattenFiles);
                }
            }

            return(observable.SubscribeSafe(observer));
        }
Example #2
0
        public static void AddSequentialBondEtlFiles(this IPlaybackConfiguration playback, params string[] files)
        {
            if (playback == null)
            {
                throw new ArgumentNullException("playback");
            }

            if (files == null)
            {
                throw new ArgumentNullException("files");
            }

            playback.AddInput(() => BinaryEtwObservable.FromSequentialFiles(files), typeof(BondJsonEnvelopeTypeMap));
        }
Example #3
0
        public static void AddBondEtlFiles(this IPlaybackConfiguration playback, params string[] files)
        {
            if (playback == null)
            {
                throw new ArgumentNullException("playback");
            }

            if (files == null)
            {
                throw new ArgumentNullException("files");
            }

            playback.AddInput(() => BinaryEtwObservable.FromFiles(files), typeof(GeneralPartitionableTypeMap));
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BinaryEtwSessionListener"/> class.
        /// </summary>
        /// <param name="sessionName">Name of the session.</param>
        /// <exception cref="ArgumentNullException">sessionName is null</exception>
        /// <exception cref="ArgumentOutOfRangeException">sessionName;Should not be empty.</exception>
        public BinaryEtwSessionListener(string sessionName)
        {
            if (sessionName == null)
            {
                throw new ArgumentNullException("sessionName");
            }

            if (string.IsNullOrEmpty(sessionName))
            {
                throw new ArgumentOutOfRangeException("sessionName", "Should not be empty.");
            }

            this.observable = BinaryEtwObservable
                              .FromSession(BinaryEventSource.Log.Guid, sessionName)
                              .Publish()
                              .RefCount();
        }