mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 11:09:05 +03:00
131 lines
4.4 KiB
Diff
131 lines
4.4 KiB
Diff
From de170f190353bb28d0eefacca5087de155948270 Mon Sep 17 00:00:00 2001
|
|
From: Eric Seifert <seiferteric@gmail.com>
|
|
Date: Tue, 21 Sep 2021 23:09:21 -0700
|
|
Subject: [PATCH 4/4] Remove uses of rusage
|
|
|
|
---
|
|
gc.c | 23 -----------------------
|
|
process.c | 37 -------------------------------------
|
|
2 files changed, 60 deletions(-)
|
|
|
|
diff --git a/gc.c b/gc.c
|
|
index 5d0c342..332340e 100644
|
|
--- a/gc.c
|
|
+++ b/gc.c
|
|
@@ -11544,17 +11544,6 @@ getrusage_time(void)
|
|
}
|
|
#endif
|
|
|
|
-#ifdef RUSAGE_SELF
|
|
- {
|
|
- struct rusage usage;
|
|
- struct timeval time;
|
|
- if (getrusage(RUSAGE_SELF, &usage) == 0) {
|
|
- time = usage.ru_utime;
|
|
- return time.tv_sec + time.tv_usec * 1e-6;
|
|
- }
|
|
- }
|
|
-#endif
|
|
-
|
|
#ifdef _WIN32
|
|
{
|
|
FILETIME creation_time, exit_time, kernel_time, user_time;
|
|
@@ -11613,18 +11602,6 @@ gc_prof_setup_new_record(rb_objspace_t *objspace, int reason)
|
|
record->flags = reason | (ruby_gc_stressful ? GPR_FLAG_STRESS : 0);
|
|
#if MALLOC_ALLOCATED_SIZE
|
|
record->allocated_size = malloc_allocated_size;
|
|
-#endif
|
|
-#if GC_PROFILE_MORE_DETAIL && GC_PROFILE_DETAIL_MEMORY
|
|
-#ifdef RUSAGE_SELF
|
|
- {
|
|
- struct rusage usage;
|
|
- if (getrusage(RUSAGE_SELF, &usage) == 0) {
|
|
- record->maxrss = usage.ru_maxrss;
|
|
- record->minflt = usage.ru_minflt;
|
|
- record->majflt = usage.ru_majflt;
|
|
- }
|
|
- }
|
|
-#endif
|
|
#endif
|
|
}
|
|
}
|
|
diff --git a/process.c b/process.c
|
|
index 674f05d..b7941aa 100644
|
|
--- a/process.c
|
|
+++ b/process.c
|
|
@@ -324,9 +324,6 @@ static ID id_GETTIMEOFDAY_BASED_CLOCK_REALTIME, id_TIME_BASED_CLOCK_REALTIME;
|
|
static ID id_TIMES_BASED_CLOCK_MONOTONIC;
|
|
static ID id_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID;
|
|
#endif
|
|
-#ifdef RUSAGE_SELF
|
|
-static ID id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID;
|
|
-#endif
|
|
static ID id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID;
|
|
#ifdef __APPLE__
|
|
static ID id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC;
|
|
@@ -7878,16 +7875,6 @@ VALUE
|
|
rb_proc_times(VALUE obj)
|
|
{
|
|
VALUE utime, stime, cutime, cstime, ret;
|
|
-#if defined(RUSAGE_SELF) && defined(RUSAGE_CHILDREN)
|
|
- struct rusage usage_s, usage_c;
|
|
-
|
|
- if (getrusage(RUSAGE_SELF, &usage_s) != 0 || getrusage(RUSAGE_CHILDREN, &usage_c) != 0)
|
|
- rb_sys_fail("getrusage");
|
|
- utime = DBL2NUM((double)usage_s.ru_utime.tv_sec + (double)usage_s.ru_utime.tv_usec/1e6);
|
|
- stime = DBL2NUM((double)usage_s.ru_stime.tv_sec + (double)usage_s.ru_stime.tv_usec/1e6);
|
|
- cutime = DBL2NUM((double)usage_c.ru_utime.tv_sec + (double)usage_c.ru_utime.tv_usec/1e6);
|
|
- cstime = DBL2NUM((double)usage_c.ru_stime.tv_sec + (double)usage_c.ru_stime.tv_usec/1e6);
|
|
-#else
|
|
const double hertz = (double)get_clk_tck();
|
|
struct tms buf;
|
|
|
|
@@ -7896,7 +7883,6 @@ rb_proc_times(VALUE obj)
|
|
stime = DBL2NUM(buf.tms_stime / hertz);
|
|
cutime = DBL2NUM(buf.tms_cutime / hertz);
|
|
cstime = DBL2NUM(buf.tms_cstime / hertz);
|
|
-#endif
|
|
ret = rb_struct_new(rb_cProcessTms, utime, stime, cutime, cstime);
|
|
RB_GC_GUARD(utime);
|
|
RB_GC_GUARD(stime);
|
|
@@ -8312,26 +8298,6 @@ rb_clock_gettime(int argc, VALUE *argv, VALUE _)
|
|
}
|
|
#endif
|
|
|
|
-#ifdef RUSAGE_SELF
|
|
-#define RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID \
|
|
- ID2SYM(id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID)
|
|
- if (clk_id == RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID) {
|
|
- struct rusage usage;
|
|
- int32_t usec;
|
|
- ret = getrusage(RUSAGE_SELF, &usage);
|
|
- if (ret != 0)
|
|
- rb_sys_fail("getrusage");
|
|
- tt.giga_count = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec;
|
|
- usec = (int32_t)(usage.ru_utime.tv_usec + usage.ru_stime.tv_usec);
|
|
- if (1000000 <= usec) {
|
|
- tt.giga_count++;
|
|
- usec -= 1000000;
|
|
- }
|
|
- tt.count = usec * 1000;
|
|
- denominators[num_denominators++] = 1000000000;
|
|
- goto success;
|
|
- }
|
|
-#endif
|
|
|
|
#ifdef HAVE_TIMES
|
|
#define RUBY_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID \
|
|
@@ -9081,9 +9047,6 @@ Init_process(void)
|
|
#ifdef HAVE_TIMES
|
|
id_TIMES_BASED_CLOCK_MONOTONIC = rb_intern_const("TIMES_BASED_CLOCK_MONOTONIC");
|
|
id_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID");
|
|
-#endif
|
|
-#ifdef RUSAGE_SELF
|
|
- id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID");
|
|
#endif
|
|
id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID");
|
|
#ifdef __APPLE__
|
|
--
|
|
2.36.1
|
|
|