Changeset 332 for binary-improvements/MapRendering/Web/API/WebAPI.cs
- Timestamp:
- Nov 16, 2018, 10:38:46 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/API/WebAPI.cs
r326 r332 2 2 using System.Text; 3 3 using AllocsFixes.JSON; 4 using UnityEngine.Profiling; 4 5 5 6 namespace AllocsFixes.NetConnections.Servers.Web.API { … … 11 12 } 12 13 14 #if ENABLE_PROFILER 15 private static readonly CustomSampler jsonSerializeSampler = CustomSampler.Create ("JSON_Serialize"); 16 private static readonly CustomSampler netWriteSampler = CustomSampler.Create ("JSON_Write"); 17 #endif 18 13 19 public static void WriteJSON (HttpListenerResponse resp, JSONNode root) { 20 #if ENABLE_PROFILER 21 jsonSerializeSampler.Begin (); 22 #endif 14 23 StringBuilder sb = new StringBuilder (); 15 24 root.ToString (sb); 25 #if ENABLE_PROFILER 26 jsonSerializeSampler.End (); 27 netWriteSampler.Begin (); 28 #endif 16 29 byte[] buf = Encoding.UTF8.GetBytes (sb.ToString ()); 17 30 resp.ContentLength64 = buf.Length; … … 19 32 resp.ContentEncoding = Encoding.UTF8; 20 33 resp.OutputStream.Write (buf, 0, buf.Length); 34 #if ENABLE_PROFILER 35 netWriteSampler.End (); 36 #endif 21 37 } 22 38
Note:
See TracChangeset
for help on using the changeset viewer.