Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix old-style function definition warnings
- Loading branch information
Showing
14 changed files
with
477 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
/* Copyright (C) 2005-2013 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com> | ||
Please see the LICENSE file for copyright and distribution information */ | ||
|
||
#ifndef __RP_CALL_TREES_H__ | ||
#define __RP_CALL_TREES_H__ | ||
|
||
#include "ruby_prof.h" | ||
#include "rp_call_tree.h" | ||
|
||
/* Array of call_tree objects */ | ||
typedef struct prof_call_trees_t | ||
{ | ||
prof_call_tree_t** start; | ||
prof_call_tree_t** end; | ||
prof_call_tree_t** ptr; | ||
|
||
VALUE object; | ||
} prof_call_trees_t; | ||
|
||
|
||
void rp_init_call_trees(); | ||
prof_call_trees_t* prof_call_trees_create(); | ||
void prof_call_trees_free(prof_call_trees_t* call_trees); | ||
prof_call_trees_t* prof_get_call_trees(VALUE self); | ||
void prof_add_call_tree(prof_call_trees_t* call_trees, prof_call_tree_t* call_tree); | ||
VALUE prof_call_trees_wrap(prof_call_trees_t* call_trees); | ||
|
||
#endif //__RP_CALL_TREES_H__ | ||
/* Copyright (C) 2005-2013 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com> | ||
Please see the LICENSE file for copyright and distribution information */ | ||
|
||
#ifndef __RP_CALL_TREES_H__ | ||
#define __RP_CALL_TREES_H__ | ||
|
||
#include "ruby_prof.h" | ||
#include "rp_call_tree.h" | ||
|
||
/* Array of call_tree objects */ | ||
typedef struct prof_call_trees_t | ||
{ | ||
prof_call_tree_t** start; | ||
prof_call_tree_t** end; | ||
prof_call_tree_t** ptr; | ||
|
||
VALUE object; | ||
} prof_call_trees_t; | ||
|
||
|
||
void rp_init_call_trees(void); | ||
prof_call_trees_t* prof_call_trees_create(void); | ||
void prof_call_trees_free(prof_call_trees_t* call_trees); | ||
prof_call_trees_t* prof_get_call_trees(VALUE self); | ||
void prof_add_call_tree(prof_call_trees_t* call_trees, prof_call_tree_t* call_tree); | ||
VALUE prof_call_trees_wrap(prof_call_trees_t* call_trees); | ||
|
||
#endif //__RP_CALL_TREES_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
/* Copyright (C) 2005-2013 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com> | ||
Please see the LICENSE file for copyright and distribution information */ | ||
|
||
/* :nodoc: */ | ||
|
||
#include "rp_measurement.h" | ||
|
||
static VALUE cMeasureAllocations; | ||
VALUE total_allocated_objects_key; | ||
|
||
static double measure_allocations(rb_trace_arg_t* trace_arg) | ||
{ | ||
static double result = 0; | ||
|
||
if (trace_arg) | ||
{ | ||
// Only process creation of new objects | ||
rb_event_flag_t event = rb_tracearg_event_flag(trace_arg); | ||
if (event == RUBY_INTERNAL_EVENT_NEWOBJ) { | ||
// Don't count allocations of internal IMemo objects | ||
VALUE object = rb_tracearg_object(trace_arg); | ||
if (BUILTIN_TYPE(object) != T_IMEMO) | ||
result++; | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
prof_measurer_t* prof_measurer_allocations(bool track_allocations) | ||
{ | ||
prof_measurer_t* measure = ALLOC(prof_measurer_t); | ||
measure->mode = MEASURE_ALLOCATIONS; | ||
measure->measure = measure_allocations; | ||
measure->multiplier = 1; | ||
// Need to track allocations to get RUBY_INTERNAL_EVENT_NEWOBJ event | ||
measure->track_allocations = track_allocations; | ||
|
||
return measure; | ||
} | ||
|
||
void rp_init_measure_allocations() | ||
{ | ||
total_allocated_objects_key = ID2SYM(rb_intern("total_allocated_objects")); | ||
rb_define_const(mProf, "ALLOCATIONS", INT2NUM(MEASURE_ALLOCATIONS)); | ||
|
||
cMeasureAllocations = rb_define_class_under(mMeasure, "Allocations", rb_cObject); | ||
} | ||
/* Copyright (C) 2005-2013 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com> | ||
Please see the LICENSE file for copyright and distribution information */ | ||
|
||
/* :nodoc: */ | ||
|
||
#include "rp_measurement.h" | ||
|
||
static VALUE cMeasureAllocations; | ||
VALUE total_allocated_objects_key; | ||
|
||
static double measure_allocations(rb_trace_arg_t* trace_arg) | ||
{ | ||
static double result = 0; | ||
|
||
if (trace_arg) | ||
{ | ||
// Only process creation of new objects | ||
rb_event_flag_t event = rb_tracearg_event_flag(trace_arg); | ||
if (event == RUBY_INTERNAL_EVENT_NEWOBJ) { | ||
// Don't count allocations of internal IMemo objects | ||
VALUE object = rb_tracearg_object(trace_arg); | ||
if (BUILTIN_TYPE(object) != T_IMEMO) | ||
result++; | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
prof_measurer_t* prof_measurer_allocations(bool track_allocations) | ||
{ | ||
prof_measurer_t* measure = ALLOC(prof_measurer_t); | ||
measure->mode = MEASURE_ALLOCATIONS; | ||
measure->measure = measure_allocations; | ||
measure->multiplier = 1; | ||
// Need to track allocations to get RUBY_INTERNAL_EVENT_NEWOBJ event | ||
measure->track_allocations = track_allocations; | ||
|
||
return measure; | ||
} | ||
|
||
void rp_init_measure_allocations(void) | ||
{ | ||
total_allocated_objects_key = ID2SYM(rb_intern("total_allocated_objects")); | ||
rb_define_const(mProf, "ALLOCATIONS", INT2NUM(MEASURE_ALLOCATIONS)); | ||
|
||
cMeasureAllocations = rb_define_class_under(mMeasure, "Allocations", rb_cObject); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,66 @@ | ||
/* Copyright (C) 2005-2019 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com> | ||
Please see the LICENSE file for copyright and distribution information */ | ||
|
||
#include "rp_measurement.h" | ||
#include <time.h> | ||
|
||
static VALUE cMeasureProcessTime; | ||
|
||
static double measure_process_time(rb_trace_arg_t* trace_arg) | ||
{ | ||
#if defined(_WIN32) | ||
FILETIME createTime; | ||
FILETIME exitTime; | ||
FILETIME kernelTime; | ||
FILETIME userTime; | ||
|
||
ULARGE_INTEGER kernelTimeInt; | ||
ULARGE_INTEGER userTimeInt; | ||
|
||
GetProcessTimes(GetCurrentProcess(), &createTime, &exitTime, &kernelTime, &userTime); | ||
|
||
kernelTimeInt.LowPart = kernelTime.dwLowDateTime; | ||
kernelTimeInt.HighPart = kernelTime.dwHighDateTime; | ||
userTimeInt.LowPart = userTime.dwLowDateTime; | ||
userTimeInt.HighPart = userTime.dwHighDateTime; | ||
|
||
return (double)(kernelTimeInt.QuadPart + userTimeInt.QuadPart); | ||
#elif !defined(CLOCK_PROCESS_CPUTIME_ID) | ||
#include <sys/resource.h> | ||
struct rusage usage; | ||
getrusage(RUSAGE_SELF, &usage); | ||
return usage.ru_stime.tv_sec + usage.ru_utime.tv_sec + ((usage.ru_stime.tv_usec + usage.ru_utime.tv_usec) / 1000000.0); | ||
#else | ||
struct timespec clock; | ||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &clock); | ||
return clock.tv_sec + (clock.tv_nsec / 1000000000.0); | ||
#endif | ||
} | ||
|
||
static double multiplier_process_time(void) | ||
{ | ||
#if defined(_WIN32) | ||
// Times are in 100-nanosecond time units. So instead of 10-9 use 10-7 | ||
return 1.0 / 10000000.0; | ||
#else | ||
return 1.0; | ||
#endif | ||
} | ||
|
||
prof_measurer_t* prof_measurer_process_time(bool track_allocations) | ||
{ | ||
prof_measurer_t* measure = ALLOC(prof_measurer_t); | ||
measure->mode = MEASURE_PROCESS_TIME; | ||
measure->measure = measure_process_time; | ||
measure->multiplier = multiplier_process_time(); | ||
measure->track_allocations = track_allocations; | ||
return measure; | ||
} | ||
|
||
void rp_init_measure_process_time() | ||
{ | ||
rb_define_const(mProf, "CLOCKS_PER_SEC", INT2NUM(CLOCKS_PER_SEC)); | ||
rb_define_const(mProf, "PROCESS_TIME", INT2NUM(MEASURE_PROCESS_TIME)); | ||
|
||
cMeasureProcessTime = rb_define_class_under(mMeasure, "ProcessTime", rb_cObject); | ||
} | ||
/* Copyright (C) 2005-2019 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com> | ||
Please see the LICENSE file for copyright and distribution information */ | ||
|
||
#include "rp_measurement.h" | ||
#include <time.h> | ||
|
||
static VALUE cMeasureProcessTime; | ||
|
||
static double measure_process_time(rb_trace_arg_t* trace_arg) | ||
{ | ||
#if defined(_WIN32) | ||
FILETIME createTime; | ||
FILETIME exitTime; | ||
FILETIME kernelTime; | ||
FILETIME userTime; | ||
|
||
ULARGE_INTEGER kernelTimeInt; | ||
ULARGE_INTEGER userTimeInt; | ||
|
||
GetProcessTimes(GetCurrentProcess(), &createTime, &exitTime, &kernelTime, &userTime); | ||
|
||
kernelTimeInt.LowPart = kernelTime.dwLowDateTime; | ||
kernelTimeInt.HighPart = kernelTime.dwHighDateTime; | ||
userTimeInt.LowPart = userTime.dwLowDateTime; | ||
userTimeInt.HighPart = userTime.dwHighDateTime; | ||
|
||
return (double)(kernelTimeInt.QuadPart + userTimeInt.QuadPart); | ||
#elif !defined(CLOCK_PROCESS_CPUTIME_ID) | ||
#include <sys/resource.h> | ||
struct rusage usage; | ||
getrusage(RUSAGE_SELF, &usage); | ||
return usage.ru_stime.tv_sec + usage.ru_utime.tv_sec + ((usage.ru_stime.tv_usec + usage.ru_utime.tv_usec) / 1000000.0); | ||
#else | ||
struct timespec clock; | ||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &clock); | ||
return clock.tv_sec + (clock.tv_nsec / 1000000000.0); | ||
#endif | ||
} | ||
|
||
static double multiplier_process_time(void) | ||
{ | ||
#if defined(_WIN32) | ||
// Times are in 100-nanosecond time units. So instead of 10-9 use 10-7 | ||
return 1.0 / 10000000.0; | ||
#else | ||
return 1.0; | ||
#endif | ||
} | ||
|
||
prof_measurer_t* prof_measurer_process_time(bool track_allocations) | ||
{ | ||
prof_measurer_t* measure = ALLOC(prof_measurer_t); | ||
measure->mode = MEASURE_PROCESS_TIME; | ||
measure->measure = measure_process_time; | ||
measure->multiplier = multiplier_process_time(); | ||
measure->track_allocations = track_allocations; | ||
return measure; | ||
} | ||
|
||
void rp_init_measure_process_time(void) | ||
{ | ||
rb_define_const(mProf, "CLOCKS_PER_SEC", INT2NUM(CLOCKS_PER_SEC)); | ||
rb_define_const(mProf, "PROCESS_TIME", INT2NUM(MEASURE_PROCESS_TIME)); | ||
|
||
cMeasureProcessTime = rb_define_class_under(mMeasure, "ProcessTime", rb_cObject); | ||
} |
Oops, something went wrong.