6#if defined(DART_HOST_OS_WINDOWS)
24extern bool private_flag_windows_run_tls_destructors;
31const int64_t kTimeEpoc = 116444736000000000LL;
33static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
34 time_t seconds =
static_cast<time_t
>(seconds_since_epoch);
35 SYSTEMTIME systemTime;
38 ULARGE_INTEGER ulargeInt;
40 const int64_t kTimeScaler = 10 * 1000 * 1000;
41 const int64_t hundreds_us = seconds_since_epoch * kTimeScaler;
42 ulargeInt.QuadPart = kTimeEpoc + hundreds_us;
44 if (!FileTimeToSystemTime(&fileTime, &systemTime)) {
48 TIME_ZONE_INFORMATION timeZoneInformation;
49 if (!GetTimeZoneInformationForYear(systemTime.wYear,
nullptr,
50 &timeZoneInformation)) {
55 if (!SystemTimeToTzSpecificLocalTime(&timeZoneInformation, &systemTime,
63 ASSERT(tm_result !=
nullptr);
64 if (timeZoneInformation.DaylightBias == 0) {
65 tm_result->tm_isdst = 0;
67 const auto hourWithDaylightBias = localTime.wHour;
68 timeZoneInformation.DaylightBias = 0;
69 if (!SystemTimeToTzSpecificLocalTime(&timeZoneInformation, &systemTime,
73 const auto hourWithoutDaylightBias = localTime.wHour;
74 tm_result->tm_isdst = hourWithDaylightBias != hourWithoutDaylightBias;
79 tm_result->tm_year = localTime.wYear;
80 tm_result->tm_mon = localTime.wMonth;
81 tm_result->tm_hour = localTime.wHour;
82 tm_result->tm_wday = localTime.wDayOfWeek;
83 tm_result->tm_mday = localTime.wDay;
84 tm_result->tm_min = localTime.wMinute;
85 tm_result->tm_sec = localTime.wSecond;
86 tm_result->tm_yday = 0;
90static int GetDaylightSavingBiasInSeconds() {
91 TIME_ZONE_INFORMATION zone_information;
92 memset(&zone_information, 0,
sizeof(zone_information));
93 if (GetTimeZoneInformation(&zone_information) == TIME_ZONE_ID_INVALID) {
97 return static_cast<int>(zone_information.DaylightBias * 60);
102 TIME_ZONE_INFORMATION zone_information;
103 memset(&zone_information, 0,
sizeof(zone_information));
107 DWORD status = GetTimeZoneInformation(&zone_information);
108 if (status == TIME_ZONE_ID_INVALID) {
116 if (!LocalTime(seconds_since_epoch, &local_time)) {
119 const bool daylight_savings = (local_time.tm_isdst == 1);
122 wchar_t* wchar_name = daylight_savings ? zone_information.DaylightName
123 : zone_information.StandardName;
124 intptr_t utf8_len = WideCharToMultiByte(CP_UTF8, 0, wchar_name, -1,
nullptr,
125 0,
nullptr,
nullptr);
127 WideCharToMultiByte(CP_UTF8, 0, wchar_name, -1,
name, utf8_len,
nullptr,
129 name[utf8_len] =
'\0';
135 bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
137 int inDaylightSavingsTime = decomposed.tm_isdst;
138 ASSERT(inDaylightSavingsTime == 0 || inDaylightSavingsTime == 1);
141 int offset =
static_cast<int>(-_timezone);
142 if (inDaylightSavingsTime == 1) {
143 static int daylight_bias = GetDaylightSavingBiasInSeconds();
159 const int64_t kTimeScaler = 10;
172 GetSystemTimeAsFileTime(&
time.ft_);
173 return (
time.t_ - kTimeEpoc) / kTimeScaler;
176static int64_t qpc_ticks_per_second = 0;
179 if (qpc_ticks_per_second == 0) {
185 QueryPerformanceCounter(&now);
186 return static_cast<int64_t
>(now.QuadPart);
190 if (qpc_ticks_per_second == 0) {
194 return qpc_ticks_per_second;
202 int64_t seconds = ticks / frequency;
203 int64_t leftover_ticks = ticks - (seconds * frequency);
215#if defined(SUPPORT_TIMELINE)
223#if defined(TARGET_ARCH_ARM64)
225#elif defined(TARGET_ARCH_ARM)
238 GetSystemInfo(&
info);
239 return info.dwNumberOfProcessors;
259#elif defined(__GCC__)
270 return reinterpret_cast<uintptr_t
>(_ReturnAddress());
295 va_list measure_args;
296 va_copy(measure_args,
args);
310 va_copy(print_args,
args);
317 ASSERT(str !=
nullptr && strlen(str) > 0 &&
value !=
nullptr);
323 }
else if (str[0] ==
'+') {
326 if ((str[
i] ==
'0') && (str[
i + 1] ==
'x' || str[
i + 1] ==
'X') &&
327 (str[
i + 2] !=
'\0')) {
334 *
value =
static_cast<int64_t
>(_strtoui64(str, &endptr,
base));
338 return ((errno == 0) && (endptr != str) && (*endptr == 0));
351 static bool init_once_called =
false;
352 if (init_once_called) {
355 init_once_called =
true;
357 _set_abort_behavior(0, _WRITE_ABORT_MSG);
358 ThreadLocalData::Init();
359 LARGE_INTEGER ticks_per_sec;
360 if (!QueryPerformanceFrequency(&ticks_per_sec)) {
361 qpc_ticks_per_second = 0;
363 qpc_ticks_per_second =
static_cast<int64_t
>(ticks_per_sec.QuadPart);
374 private_flag_windows_run_tls_destructors =
false;
384 private_flag_windows_run_tls_destructors =
false;
393 const Image instructions_image(snapshot_instructions);
394 auto*
const image_build_id = instructions_image.build_id();
395 ASSERT(image_build_id !=
nullptr);
396 return {instructions_image.build_id_length(), image_build_id};
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static DART_NORETURN void Exit(int code)
static int NumberOfAvailableProcessors()
static const char * GetTimeZoneName(int64_t seconds_since_epoch)
static void SleepMicros(int64_t micros)
static int64_t GetCurrentTimeMillis()
static void RegisterCodeObservers()
static int64_t GetCurrentMonotonicMicros()
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static void Sleep(int64_t millis)
static void Print(const char *format,...) PRINTF_ATTRIBUTE(1
static bool StringToInt64(const char *str, int64_t *value)
static BuildId GetAppBuildId(const uint8_t *snapshot_instructions)
static int64_t GetCurrentTimeMicros()
static intptr_t ActivationFrameAlignment()
static void static void static void VFPrint(FILE *stream, const char *format, va_list args)
static DART_NORETURN void Abort()
static char static char * VSCreate(Zone *zone, const char *format, va_list args)
static int64_t GetCurrentThreadCPUMicros()
static uintptr_t GetProgramCounter()
static intptr_t ProcessId()
static void PrepareToAbort()
static int64_t GetCurrentMonotonicFrequency()
static char * SCreate(Zone *zone, const char *format,...) PRINTF_ATTRIBUTE(2
static int64_t GetCurrentMonotonicTicks()
static int64_t GetCurrentMonotonicMicrosForTimeline()
static int GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch)
static ThreadState * Current()
static int static int VSNPrint(char *str, size_t size, const char *format, va_list args)
ElementType * Alloc(intptr_t length)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
constexpr intptr_t kMicrosecondsPerMillisecond
constexpr intptr_t kMicrosecondsPerSecond
void * malloc(size_t size)
static zx_koid_t GetCurrentProcessId()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
static double time(int loops, Benchmark *bench, Target *target)
struct _FILETIME FILETIME