2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 using System.Threading.Tasks;
22 namespace Tizen.Runtime
26 const string profilePath = "/home/owner/data/.__tizen_candidate_profile_data";
28 private static void stop()
30 Console.WriteLine("Stop profile and write collected data");
31 ProfileOptimization.StartProfile(null);
34 public static void StopProfileAfterDelay(int sec)
36 Console.WriteLine($"Stop profile after {sec} sec");
37 Task.Delay(sec * 1000).ContinueWith(_ => stop());
40 public static void SetCandidateProcessProfile()
44 if (File.Exists(profilePath))
46 Environment.SetEnvironmentVariable("COMPlus_MultiCoreJitNoProfileGather", "1");
47 Environment.SetEnvironmentVariable("COMPlus_MultiCoreJitMinNumCpus", "1");
48 ProfileOptimization.SetProfileRoot("");
49 ProfileOptimization.StartProfile(profilePath);
50 Console.WriteLine("Completed loading of profile data to the candidate process");
55 Console.WriteLine(e.ToString());