Changeset 394 for binary-improvements2/WebServer/src/WebUtils.cs
- Timestamp:
- Aug 8, 2022, 8:07:44 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/WebServer/src/WebUtils.cs
r391 r394 12 12 public const string MimeJson = "application/json"; 13 13 14 #if ENABLE_PROFILER15 14 private static readonly UnityEngine.Profiling.CustomSampler jsonSerializeSampler = UnityEngine.Profiling.CustomSampler.Create ("JSON_Serialize"); 16 15 private static readonly UnityEngine.Profiling.CustomSampler netWriteSampler = UnityEngine.Profiling.CustomSampler.Create ("JSON_Write"); 17 #endif18 16 19 17 public static void WriteJson (HttpListenerResponse _resp, JsonNode _root, HttpStatusCode _statusCode = HttpStatusCode.OK) { 20 #if ENABLE_PROFILER21 18 jsonSerializeSampler.Begin (); 22 #endif23 19 StringBuilder sb = new StringBuilder (); 24 20 _root.ToString (sb); 25 #if ENABLE_PROFILER26 21 jsonSerializeSampler.End (); 27 22 netWriteSampler.Begin (); 28 #endif29 23 WriteText (_resp, sb.ToString(), _statusCode, MimeJson); 30 #if ENABLE_PROFILER31 24 netWriteSampler.End (); 32 #endif33 25 } 34 26
Note:
See TracChangeset
for help on using the changeset viewer.