mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 10:46:17 +00:00
提交完美
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08fe2a0eeed74d1db5fa680814c1a9b3
|
||||
timeCreated: 1720682585
|
@@ -0,0 +1,66 @@
|
||||
namespace JNGame.Runtime.Util.NoThread
|
||||
{
|
||||
public class Interlocked
|
||||
{
|
||||
public static long Read(ref long location)
|
||||
{
|
||||
return location;
|
||||
}
|
||||
public static int Increment(ref int location)
|
||||
{
|
||||
return location += 1;
|
||||
}
|
||||
public static long Increment(ref long location)
|
||||
{
|
||||
return location += 1;
|
||||
}
|
||||
public static int Decrement(ref int location)
|
||||
{
|
||||
return location -= 1;
|
||||
}
|
||||
public static long Decrement(ref long location)
|
||||
{
|
||||
return location -= 1;
|
||||
}
|
||||
public static int Exchange(ref int location, int value)
|
||||
{
|
||||
int temp = location;
|
||||
return location = value;
|
||||
}
|
||||
public static long Exchange(ref long location, long value)
|
||||
{
|
||||
long temp = location;
|
||||
return location = value;
|
||||
}
|
||||
public static int Add(ref int location, int value)
|
||||
{
|
||||
return location += value;
|
||||
}
|
||||
public static long Add(ref long location, long value)
|
||||
{
|
||||
return location += value;
|
||||
}
|
||||
public static int CompareExchange(ref int location, int value, int comparand)
|
||||
{
|
||||
if (location == comparand)
|
||||
{
|
||||
return location = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return location;
|
||||
}
|
||||
}
|
||||
public static long CompareExchange(ref long location, long value, long comparand)
|
||||
{
|
||||
if (location == comparand)
|
||||
{
|
||||
return location = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return location;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a13340b679274363b976467f30806a56
|
||||
timeCreated: 1720682597
|
49
JNFrame2/Assets/HotScripts/JNGame/Root/Util/Profiler.cs
Normal file
49
JNFrame2/Assets/HotScripts/JNGame/Root/Util/Profiler.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace JNGame.Runtime.Util
|
||||
{
|
||||
public class Profiler
|
||||
{
|
||||
|
||||
// [System.Diagnostics.Conditional("ENABLE_TEST_SROPTIONS")]
|
||||
public static void BeginSample(string tag)
|
||||
{
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
UnityEngine.Profiling.Profiler.BeginSample(tag);
|
||||
#endif
|
||||
}
|
||||
|
||||
// [System.Diagnostics.Conditional("ENABLE_TEST_SROPTIONS")]
|
||||
public static void EndSample()
|
||||
{
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
UnityEngine.Profiling.Profiler.EndSample();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统计标记时间
|
||||
/// </summary>
|
||||
private static DateTime s_MarkStart;
|
||||
|
||||
/// <summary>
|
||||
/// 重置当前时间
|
||||
/// </summary>
|
||||
public static void ResetElapseTime()
|
||||
{
|
||||
s_MarkStart = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统计时间间隔,单位:毫秒
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
public static void LogElapseTime(string tag = "")
|
||||
{
|
||||
var ms = (DateTime.Now - s_MarkStart).TotalMilliseconds;
|
||||
Debug.LogWarning($"{tag} use time:{ms} ms");
|
||||
s_MarkStart = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75ef2062d79a44248c98964373827d74
|
||||
timeCreated: 1715153593
|
Reference in New Issue
Block a user