Show More
Commit Description:
Add timers for Simulation and various engines...
Commit Description:
Add timers for Simulation and various engines Starting to add additional timers for different stages of the process of updating in order to get more insight into what is slowing it down. The update takes 9ms, which is much longer than it used to. Engine-specific timers are coming later.
File last commit:
Show/Diff file:
Action:
ImGui.NET/Util.cs
72 lines | 2.0 KiB | text/x-csharp | CSharpLexer
Add ImGui.
r16 using System;
using System.Runtime.InteropServices;
using System.Text;
namespace ImGuiNET
{
internal static unsafe class Util
{
internal const int StackAllocationSizeLimit = 2048;
public static string StringFromPtr(byte* ptr)
{
int characters = 0;
while (ptr[characters] != 0)
{
characters++;
}
return Encoding.UTF8.GetString(ptr, characters);
}
internal static bool AreStringsEqual(byte* a, int aLength, byte* b)
{
for (int i = 0; i < aLength; i++)
{
if (a[i] != b[i]) { return false; }
}
if (b[aLength] != 0) { return false; }
return true;
}
internal static byte* Allocate(int byteCount) => (byte*)Marshal.AllocHGlobal(byteCount);
Get really basic graph working.
r503
Add ImGui.
r16 internal static void Free(byte* ptr) => Marshal.FreeHGlobal((IntPtr)ptr);
Get really basic graph working.
r503
internal static int CalcSizeInUtf8(string s, int start, int length)
{
if (start < 0 || length < 0 || start + length > s.Length)
{
throw new ArgumentOutOfRangeException();
}
fixed (char* utf16Ptr = s)
{
return Encoding.UTF8.GetByteCount(utf16Ptr + start, length);
}
}
Add ImGui.
r16 internal static int GetUtf8(string s, byte* utf8Bytes, int utf8ByteCount)
{
fixed (char* utf16Ptr = s)
{
return Encoding.UTF8.GetBytes(utf16Ptr, s.Length, utf8Bytes, utf8ByteCount);
}
}
Get really basic graph working.
r503
internal static int GetUtf8(string s, int start, int length, byte* utf8Bytes, int utf8ByteCount)
{
if (start < 0 || length < 0 || start + length > s.Length)
{
throw new ArgumentOutOfRangeException();
}
fixed (char* utf16Ptr = s)
{
return Encoding.UTF8.GetBytes(utf16Ptr + start, length, utf8Bytes, utf8ByteCount);
}
}
Add ImGui.
r16 }
}