private void OnManifestReceived(ProviderManifest providerManifest) { if (providerManifest.Error != null) { this.logger.TraceEventServiceManifestGenerationFault(providerManifest.Guid, providerManifest.Error.ToString()); return; } // Update schemas for this provider this.schemaCache.UpdateSchemaFromManifest(providerManifest.Guid, providerManifest.Manifest); // Update manifest cache so any new worker instance may pick up the updates version on start up by calling "this.manifestCache.Read()". // Notice that we are refreshing the manifest with the latest version received so any older version will be overwritten. this.manifestCache.Write(); }
internal DynamicManifestTraceEventData(Action<TraceEvent> action, ProviderManifest manifest) : base(action, 0xFFFE, 0, "ManifestData", Guid.Empty, 0, null, manifest.Guid, manifest.Name) { this.manifest = manifest; payloadNames = new string[] { "Format", "MajorVersion", "MinorVersion", "Magic", "TotalChunks", "ChunkNumber" }; payloadFetches = new PayloadFetch[] { new PayloadFetch(0, 1, typeof(byte)), new PayloadFetch(1, 1, typeof(byte)), new PayloadFetch(2, 1, typeof(byte)), new PayloadFetch(3, 1, typeof(byte)), new PayloadFetch(4, 2, typeof(ushort)), new PayloadFetch(6, 2, typeof(ushort)), }; Action += action; }
internal unsafe ProviderManifest AddChunk(TraceEvent data) { //SLAB update //removed check to allow recomputing new manifest on any new incoming chunk //if (provider != null) // return null; // TODO if (data.EventDataLength <= sizeof(ManifestEnvelope) || data.GetByteAt(3) != 0x5B) // magic number return null; ushort totalChunks = (ushort)data.GetInt16At(4); ushort chunkNum = (ushort)data.GetInt16At(6); if (chunkNum >= totalChunks || totalChunks == 0) return null; // SLAB update if (Chunks == null || (lastChunkReceptionTime.HasValue && lastChunkReceptionTime.Value.Add(ChunkReceptionStalePeriod) < DateTime.Now)) { format = (ManifestEnvelope.ManifestFormats)data.GetByteAt(0); majorVersion = (byte)data.GetByteAt(1); minorVersion = (byte)data.GetByteAt(2); ChunksLeft = totalChunks; Chunks = new byte[ChunksLeft][]; } else { // Chunks have to agree with the format and version information. if (format != (ManifestEnvelope.ManifestFormats)data.GetByteAt(0) || majorVersion != data.GetByteAt(1) || minorVersion != data.GetByteAt(2)) return null; } if (Chunks[chunkNum] != null) return null; byte[] chunk = new byte[data.EventDataLength - 8]; Chunks[chunkNum] = data.EventData(chunk, 0, 8, chunk.Length); --ChunksLeft; lastChunkReceptionTime = DateTime.Now; // SLAB update if (ChunksLeft > 0) return null; // OK we have a complete set of chunks byte[] serializedData = Chunks[0]; if (Chunks.Length > 1) { int totalLength = 0; for (int i = 0; i < Chunks.Length; i++) totalLength += Chunks[i].Length; // Concatinate all the arrays. serializedData = new byte[totalLength]; int pos = 0; for (int i = 0; i < Chunks.Length; i++) { Array.Copy(Chunks[i], 0, serializedData, pos, Chunks[i].Length); pos += Chunks[i].Length; } } Chunks = null; lastChunkReceptionTime = null; // SLAB update // string str = Encoding.UTF8.GetString(serializedData); provider = new ProviderManifest(serializedData, format, majorVersion, minorVersion); provider.ISDynamic = true; return provider; }
/// <summary> /// Given a manifest describing the provider add its information to the parser. /// </summary> /// <param name="providerManifest"></param> public void AddDynamicProvider(ProviderManifest providerManifest) { // Remember this serialized information. state.providers[providerManifest.Guid] = providerManifest; // If someone as asked for callbacks on every event, then include these too. if (allCallbackCalled) providerManifest.AddProviderEvents(source, allCallback); }