Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: runtime/vm/os_linux.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/os_fuchsia.cc ('k') | runtime/vm/os_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_linux.cc
diff --git a/runtime/vm/os_linux.cc b/runtime/vm/os_linux.cc
index c0f5b8b841c3b7fd4261ea604d2365a58d09c9da..ccbc7e51e4f07abe06506e8e625c7e1bb01f1903 100644
--- a/runtime/vm/os_linux.cc
+++ b/runtime/vm/os_linux.cc
@@ -8,15 +8,15 @@
#include "vm/os.h"
#include <errno.h> // NOLINT
+#include <fcntl.h> // NOLINT
#include <limits.h> // NOLINT
#include <malloc.h> // NOLINT
-#include <time.h> // NOLINT
#include <sys/resource.h> // NOLINT
+#include <sys/stat.h> // NOLINT
+#include <sys/syscall.h> // NOLINT
#include <sys/time.h> // NOLINT
#include <sys/types.h> // NOLINT
-#include <sys/syscall.h> // NOLINT
-#include <sys/stat.h> // NOLINT
-#include <fcntl.h> // NOLINT
+#include <time.h> // NOLINT
#include <unistd.h> // NOLINT
#include "platform/memory_sanitizer.h"
@@ -29,7 +29,6 @@
#include "vm/os_thread.h"
#include "vm/zone.h"
-
namespace dart {
#ifndef PRODUCT
@@ -90,19 +89,16 @@ class PerfCodeObserver : public CodeObserver {
DISALLOW_COPY_AND_ASSIGN(PerfCodeObserver);
};
-
#endif // !PRODUCT
const char* OS::Name() {
return "linux";
}
-
intptr_t OS::ProcessId() {
return static_cast<intptr_t>(getpid());
}
-
static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
time_t seconds = static_cast<time_t>(seconds_since_epoch);
if (seconds != seconds_since_epoch) return false;
@@ -110,7 +106,6 @@ static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
return error_code != NULL;
}
-
const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) {
tm decomposed;
bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
@@ -118,7 +113,6 @@ const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) {
return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : "";
}
-
int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) {
tm decomposed;
bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
@@ -127,7 +121,6 @@ int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) {
return succeeded ? static_cast<int>(decomposed.tm_gmtoff) : 0;
}
-
int OS::GetLocalTimeZoneAdjustmentInSeconds() {
// TODO(floitsch): avoid excessive calls to tzset?
tzset();
@@ -136,12 +129,10 @@ int OS::GetLocalTimeZoneAdjustmentInSeconds() {
return static_cast<int>(-timezone);
}
-
int64_t OS::GetCurrentTimeMillis() {
return GetCurrentTimeMicros() / 1000;
}
-
int64_t OS::GetCurrentTimeMicros() {
// gettimeofday has microsecond resolution.
struct timeval tv;
@@ -152,7 +143,6 @@ int64_t OS::GetCurrentTimeMicros() {
return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
}
-
int64_t OS::GetCurrentMonotonicTicks() {
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
@@ -166,19 +156,16 @@ int64_t OS::GetCurrentMonotonicTicks() {
return result;
}
-
int64_t OS::GetCurrentMonotonicFrequency() {
return kNanosecondsPerSecond;
}
-
int64_t OS::GetCurrentMonotonicMicros() {
int64_t ticks = GetCurrentMonotonicTicks();
ASSERT(GetCurrentMonotonicFrequency() == kNanosecondsPerSecond);
return ticks / kNanosecondsPerMicrosecond;
}
-
int64_t OS::GetCurrentThreadCPUMicros() {
struct timespec ts;
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) {
@@ -191,7 +178,6 @@ int64_t OS::GetCurrentThreadCPUMicros() {
return result;
}
-
// TODO(5411554): May need to hoist these architecture dependent code
// into a architecture specific file e.g: os_ia32_linux.cc
intptr_t OS::ActivationFrameAlignment() {
@@ -212,7 +198,6 @@ intptr_t OS::ActivationFrameAlignment() {
return alignment;
}
-
intptr_t OS::PreferredCodeAlignment() {
#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \
defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC)
@@ -232,12 +217,10 @@ intptr_t OS::PreferredCodeAlignment() {
return alignment;
}
-
int OS::NumberOfAvailableProcessors() {
return sysconf(_SC_NPROCESSORS_ONLN);
}
-
uintptr_t OS::MaxRSS() {
struct rusage usage;
usage.ru_maxrss = 0;
@@ -246,13 +229,11 @@ uintptr_t OS::MaxRSS() {
return usage.ru_maxrss * KB;
}
-
void OS::Sleep(int64_t millis) {
int64_t micros = millis * kMicrosecondsPerMillisecond;
SleepMicros(micros);
}
-
void OS::SleepMicros(int64_t micros) {
struct timespec req; // requested.
struct timespec rem; // remainder.
@@ -273,7 +254,6 @@ void OS::SleepMicros(int64_t micros) {
}
}
-
// TODO(regis, iposva): When this function is no longer called from the
// CodeImmutability test in object_test.cc, it will be called only from the
// simulator, which means that only the Intel implementation is needed.
@@ -281,23 +261,19 @@ void OS::DebugBreak() {
__builtin_trap();
}
-
uintptr_t DART_NOINLINE OS::GetProgramCounter() {
return reinterpret_cast<uintptr_t>(
__builtin_extract_return_addr(__builtin_return_address(0)));
}
-
char* OS::StrNDup(const char* s, intptr_t n) {
return strndup(s, n);
}
-
intptr_t OS::StrNLen(const char* s, intptr_t n) {
return strnlen(s, n);
}
-
void OS::Print(const char* format, ...) {
va_list args;
va_start(args, format);
@@ -305,13 +281,11 @@ void OS::Print(const char* format, ...) {
va_end(args);
}
-
void OS::VFPrint(FILE* stream, const char* format, va_list args) {
vfprintf(stream, format, args);
fflush(stream);
}
-
int OS::SNPrint(char* str, size_t size, const char* format, ...) {
va_list args;
va_start(args, format);
@@ -320,7 +294,6 @@ int OS::SNPrint(char* str, size_t size, const char* format, ...) {
return retval;
}
-
int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
MSAN_UNPOISON(str, size);
int retval = vsnprintf(str, size, format, args);
@@ -330,7 +303,6 @@ int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
return retval;
}
-
char* OS::SCreate(Zone* zone, const char* format, ...) {
va_list args;
va_start(args, format);
@@ -339,7 +311,6 @@ char* OS::SCreate(Zone* zone, const char* format, ...) {
return buffer;
}
-
char* OS::VSCreate(Zone* zone, const char* format, va_list args) {
// Measure.
va_list measure_args;
@@ -363,7 +334,6 @@ char* OS::VSCreate(Zone* zone, const char* format, va_list args) {
return buffer;
}
-
bool OS::StringToInt64(const char* str, int64_t* value) {
ASSERT(str != NULL && strlen(str) > 0 && value != NULL);
int32_t base = 10;
@@ -381,7 +351,6 @@ bool OS::StringToInt64(const char* str, int64_t* value) {
return ((errno == 0) && (endptr != str) && (*endptr == 0));
}
-
void OS::RegisterCodeObservers() {
#ifndef PRODUCT
if (FLAG_generate_perf_events_symbols) {
@@ -390,7 +359,6 @@ void OS::RegisterCodeObservers() {
#endif // !PRODUCT
}
-
void OS::PrintErr(const char* format, ...) {
va_list args;
va_start(args, format);
@@ -398,7 +366,6 @@ void OS::PrintErr(const char* format, ...) {
va_end(args);
}
-
void OS::InitOnce() {
// TODO(5411554): For now we check that initonce is called only once,
// Once there is more formal mechanism to call InitOnce we can move
@@ -408,15 +375,12 @@ void OS::InitOnce() {
init_once_called = true;
}
-
void OS::Shutdown() {}
-
void OS::Abort() {
abort();
}
-
void OS::Exit(int code) {
exit(code);
}
« no previous file with comments | « runtime/vm/os_fuchsia.cc ('k') | runtime/vm/os_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698