From 926eb6df5a471f38dd4297a99c7b1dfceb10b7d6 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Thu, 21 Jul 2022 10:45:20 +0900 Subject: [PATCH] [Tizen.Log] Replace getting filename with a primitive (fast) way This enhances speed up to 5x faster than using library functions when it comes to a burst call. Signed-off-by: Youngjae Cho --- src/Tizen.Log/Tizen/Log.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) mode change 100644 => 100755 src/Tizen.Log/Tizen/Log.cs diff --git a/src/Tizen.Log/Tizen/Log.cs b/src/Tizen.Log/Tizen/Log.cs old mode 100644 new mode 100755 index 1869852..3bb3854 --- a/src/Tizen.Log/Tizen/Log.cs +++ b/src/Tizen.Log/Tizen/Log.cs @@ -16,6 +16,7 @@ using System; using System.IO; +using System.Linq; using System.Runtime.CompilerServices; using System.ComponentModel; @@ -120,8 +121,9 @@ namespace Tizen } else { - Uri f = new Uri("file://" + file); - Interop.Dlog.Print(priority, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); + string[] fileslice = file.Split(new char[] { '\\', '/' }); + string filename = fileslice.Last(); + Interop.Dlog.Print(priority, tag, "%s: %s(%d) > %s", filename, func, line, message); } } } @@ -226,8 +228,9 @@ namespace Tizen } else { - Uri f = new Uri("file://" + file); - Interop.Dlog.InternalPrint(log_id, priority, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); + string[] fileslice = file.Split(new char[] { '\\', '/' }); + string filename = fileslice.Last(); + Interop.Dlog.InternalPrint(log_id, priority, tag, "%s: %s(%d) > %s", filename, func, line, message); } } } @@ -333,8 +336,9 @@ namespace Tizen } else { - Uri f = new Uri("file://" + file); - Interop.Dlog.InternalPrint(log_id, priority, tag, "%s: %s(%d) > [SECURE_LOG] %s", Path.GetFileName(f.AbsolutePath), func, line, message); + string[] fileslice = file.Split(new char[] { '\\', '/' }); + string filename = fileslice.Last(); + Interop.Dlog.InternalPrint(log_id, priority, tag, "%s: %s(%d) > %s", filename, func, line, message); } #endif } -- 2.7.4