| Index: third_party/grpc/src/csharp/Grpc.Core/Profiling/ProfilerEntry.cs
|
| diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs b/third_party/grpc/src/csharp/Grpc.Core/Profiling/ProfilerEntry.cs
|
| similarity index 54%
|
| copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
|
| copy to third_party/grpc/src/csharp/Grpc.Core/Profiling/ProfilerEntry.cs
|
| index e547d834986de8d80703504469e9c39b3d8ae93d..792e3c3cd056dfbd6d8743b160300a2363243d60 100644
|
| --- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
|
| +++ b/third_party/grpc/src/csharp/Grpc.Core/Profiling/ProfilerEntry.cs
|
| @@ -1,7 +1,7 @@
|
| #region Copyright notice and license
|
| -// Protocol Buffers - Google's data interchange format
|
| -// Copyright 2008 Google Inc. All rights reserved.
|
| -// https://developers.google.com/protocol-buffers/
|
| +
|
| +// Copyright 2015, Google Inc.
|
| +// All rights reserved.
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -28,41 +28,61 @@
|
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| +
|
| #endregion
|
|
|
| -namespace Google.Protobuf.Reflection
|
| +using System;
|
| +using System.IO;
|
| +using System.Threading;
|
| +using Grpc.Core.Internal;
|
| +
|
| +namespace Grpc.Core.Profiling
|
| {
|
| - /// <summary>
|
| - /// Represents a package in the symbol table. We use PackageDescriptors
|
| - /// just as placeholders so that someone cannot define, say, a message type
|
| - /// that has the same name as an existing package.
|
| - /// </summary>
|
| - internal sealed class PackageDescriptor : IDescriptor
|
| + internal struct ProfilerEntry
|
| {
|
| - private readonly string name;
|
| - private readonly string fullName;
|
| - private readonly FileDescriptor file;
|
| -
|
| - internal PackageDescriptor(string name, string fullName, FileDescriptor file)
|
| + public enum Type
|
| {
|
| - this.file = file;
|
| - this.fullName = fullName;
|
| - this.name = name;
|
| + BEGIN,
|
| + END,
|
| + MARK
|
| }
|
|
|
| - public string Name
|
| + public ProfilerEntry(Timespec timespec, Type type, string tag)
|
| {
|
| - get { return name; }
|
| + this.timespec = timespec;
|
| + this.type = type;
|
| + this.tag = tag;
|
| }
|
|
|
| - public string FullName
|
| + public Timespec timespec;
|
| + public Type type;
|
| + public string tag;
|
| +
|
| + public override string ToString()
|
| {
|
| - get { return fullName; }
|
| + // mimic the output format used by C core.
|
| + return string.Format(
|
| + "{{\"t\": {0}.{1}, \"thd\":\"unknown\", \"type\": \"{2}\", \"tag\": \"{3}\", " +
|
| + "\"file\": \"unknown\", \"line\": 0, \"imp\": 0}}",
|
| + timespec.TimevalSeconds, timespec.TimevalNanos.ToString("D9"),
|
| + GetTypeAbbreviation(type), tag);
|
| }
|
|
|
| - public FileDescriptor File
|
| + internal static string GetTypeAbbreviation(Type type)
|
| {
|
| - get { return file; }
|
| + switch (type)
|
| + {
|
| + case Type.BEGIN:
|
| + return "{";
|
| +
|
| + case Type.END:
|
| + return "}";
|
| +
|
| + case Type.MARK:
|
| + return ".";
|
| + default:
|
| + throw new ArgumentException("Unknown type");
|
| + }
|
| }
|
| }
|
| -}
|
| +}
|
|
|