Example #1
0
        private static string GetUsings()
        {
            StringBuilder builder = new StringBuilder();

            foreach (var providerName in ManifestCompiler.GetProviders())
            {
                builder.Append("using Tx.Windows.").Append(providerName).AppendLine(";");
            }

            return(builder.ToString());
        }
Example #2
0
        /// <summary>
        /// The known types seems to have a bug if added to a typed query.
        /// We should not pass this for query execution and only doing
        /// generic etw queries.
        /// </summary>
        /// <returns></returns>
        public static Type[] GetKnowntypesforPlayback()
        {
            List <Type> types = new List <Type>();

            foreach (var path in ManifestCompiler.GetGeneratedAssemblies())
            {
                types.AddRange(Assembly.LoadFile(path).GetTypes());
            }

            return(types.Distinct().ToArray());
        }
Example #3
0
        internal IDictionary <Type, long> GetStats()
        {
            var stat = new TypeOccurenceStatistics(ManifestCompiler.GetKnowntypesforPlayback());

            foreach (var item in this.files)
            {
                stat.AddEtlFiles(item);
            }

            stat.Run();
            return(stat.Statistics);
        }
Example #4
0
        private IEnumerable <EventDefinition> GetEventsFromCompiledManifests(Guid provider)
        {
            var q = from s in ManifestCompiler.GetKnowntypesforPlayback()
                    let attr = (ManifestEventAttribute)s.GetCustomAttributes(true).Where((e) => e is ManifestEventAttribute).FirstOrDefault()
                               where attr != null && attr.ProviderGuid == provider
                               select new EventDefinition
            {
                Id   = attr.EventId,
                Name = s.Name
            };

            return(q.ToList());
        }
Example #5
0
        private static string[] GetAssemblies()
        {
            List <string> assemblies = new List <string>();

            assemblies.Add("mscorlib.dll");
            assemblies.Add("System.dll");
            assemblies.Add("System.Core.dll");
            foreach (string location in GetAssemblyLocations())
            {
                assemblies.Add(location);
            }

            foreach (string assembly in ManifestCompiler.GetGeneratedAssemblies())
            {
                assemblies.Add(assembly);
            }

            return(assemblies.ToArray());
        }
        internal static QueryExecutionContext CreateFromFiles(IList <string> etlfiles, Action <Type> onStart, Action <object> onNext)
        {
            Playback playback = new Playback();

            foreach (var item in etlfiles)
            {
                playback.AddEtlFiles(item);
            }

            Func <Type, object, Action <object> > v = (t, o) =>
            {
                onStart(t);
                return(onNext);
            };
            QueryExecutionContext context = new QueryExecutionContext(playback, v);

            playback.KnownTypes = ManifestCompiler.GetKnowntypesforPlayback();
            return(context);
        }
Example #7
0
        internal override IObservable <EventRecordProxy> GetObservableEvents()
        {
            Playback playback = new Playback();

            if (this.IsRealtime)
            {
                playback.AddRealTimeSession(this.files.First());
            }
            else
            {
                foreach (var item in this.files)
                {
                    playback.AddEtlFiles(item);
                }
            }

            playback.KnownTypes = ManifestCompiler.GetKnowntypesforPlayback();

            return(new EventRecordProxyObserver(playback, this));
        }