Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bbf6cfa

Browse files
committedJun 26, 2015
Merge remote-tracking branch 'origin' into 1.8.7
Conflicts: kernel/common/gc.rb vm/builtin/data.cpp vm/llvm/state.cpp
2 parents d0d184f + 47fcb42 commit bbf6cfa

34 files changed

+363
-436
lines changed
 

‎vm/builtin/block_environment.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ namespace rubinius {
8383
}
8484
}
8585

86+
state->vm()->metrics().machine.blocks_invoked++;
87+
8688
#ifdef ENABLE_LLVM
8789
if(executor ptr = mcode->unspecialized) {
8890
return (*((BlockExecutor)ptr))(state, previous, env, args, invocation);

‎vm/builtin/call_site.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ namespace rubinius {
8080
}
8181
}
8282

83+
state->vm()->metrics().machine.methods_invoked++;
84+
8385
call_site->update(state, recv_class, dis);
8486

8587
Executable* meth = dis.method;
@@ -112,6 +114,8 @@ namespace rubinius {
112114
}
113115
}
114116

117+
state->vm()->metrics().machine.methods_invoked++;
118+
115119
call_site->update(state, recv_class, dis);
116120

117121
Executable* meth = dis.method;
@@ -146,6 +150,8 @@ namespace rubinius {
146150
}
147151
}
148152

153+
state->vm()->metrics().machine.methods_invoked++;
154+
149155
call_site->update(state, recv_class, dis);
150156

151157
Executable* meth = dis.method;
@@ -201,6 +207,8 @@ namespace rubinius {
201207
state->vm()->global_cache()->add_seen(state, call_site->name());
202208
}
203209

210+
state->vm()->metrics().machine.methods_invoked++;
211+
204212
call_site->update(state, recv_class, dis);
205213

206214
Executable* meth = dis.method;

‎vm/builtin/data.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace rubinius {
4242
state->memory()->needs_finalization(data, (FinalizerFunction)&Data::finalize);
4343
}
4444

45-
state->vm()->metrics().m.ruby_metrics.memory_data_objects++;
45+
state->vm()->metrics().memory.data_objects++;
4646

4747
return data;
4848
}

‎vm/builtin/io.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ namespace rubinius {
620620
data += wrote;
621621
bytes -= wrote;
622622

623-
state->vm()->metrics().system_metrics.io_write_bytes += wrote;
623+
state->vm()->metrics().system.write_bytes += wrote;
624624
}
625625
}
626626
}
@@ -704,7 +704,7 @@ namespace rubinius {
704704
return cNil;
705705
}
706706

707-
state->vm()->metrics().system_metrics.io_read_bytes += bytes_read;
707+
state->vm()->metrics().system.read_bytes += bytes_read;
708708

709709
String* str = String::create(state, buf, bytes_read);
710710
if(malloc_buf) free(malloc_buf);
@@ -753,7 +753,7 @@ namespace rubinius {
753753

754754
if(bytes_read == 0) return cNil;
755755

756-
state->vm()->metrics().system_metrics.io_read_bytes += bytes_read;
756+
state->vm()->metrics().system.read_bytes += bytes_read;
757757

758758
buffer->num_bytes(state, Fixnum::from(bytes_read));
759759
return buffer;
@@ -808,7 +808,7 @@ namespace rubinius {
808808
left -= cnt;
809809
cur += cnt;
810810

811-
state->vm()->metrics().system_metrics.io_write_bytes += cnt;
811+
state->vm()->metrics().system.write_bytes += cnt;
812812
}
813813
}
814814

@@ -836,7 +836,7 @@ namespace rubinius {
836836
int n = ::write(descriptor_->to_native(), buf->byte_address(), buf_size);
837837
if(n == -1) Exception::errno_error(state, "write_nonblock");
838838

839-
state->vm()->metrics().system_metrics.io_write_bytes += n;
839+
state->vm()->metrics().system.write_bytes += n;
840840

841841
return Fixnum::from(n);
842842
}
@@ -1487,7 +1487,7 @@ namespace rubinius {
14871487
}
14881488
memcpy(self->at_unused(), temp_buffer, bytes_read);
14891489
self->read_bytes(state, bytes_read);
1490-
state->vm()->metrics().system_metrics.io_read_bytes += bytes_read;
1490+
state->vm()->metrics().system.read_bytes += bytes_read;
14911491
}
14921492

14931493
return Fixnum::from(bytes_read);

‎vm/builtin/mono_inline_cache.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ namespace rubinius {
7070

7171
if(likely(cache->receiver_.raw == recv_data)) {
7272
cache->hits_++;
73+
state->vm()->metrics().machine.methods_invoked++;
7374
return cache->method_->execute(state, call_frame, cache->method_, cache->stored_module_, args);
7475
}
7576

@@ -86,6 +87,7 @@ namespace rubinius {
8687

8788
if(likely(cache->receiver_.raw == recv_data)) {
8889
cache->hits_++;
90+
state->vm()->metrics().machine.methods_invoked++;
8991
state->vm()->set_method_missing_reason(cache->method_missing_);
9092
args.unshift(state, call_site->name_);
9193
return cache->method_->execute(state, call_frame, cache->method_, cache->stored_module_, args);

‎vm/builtin/native_function.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ namespace rubinius {
338338
// Apparently we're running in a new thread here, setup
339339
// everything we need here.
340340
vm = stub->shared->new_vm();
341-
vm->metrics().init(metrics::eRubyMetrics);
342341

343342
// Detect the stack size and set it up in the VM object
344343
size_t stack_size;

‎vm/builtin/native_method.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace rubinius {
4141
, current_native_frame_(0)
4242
, current_ep_(0)
4343
, outgoing_block_(0)
44+
, metrics_()
4445
{}
4546

4647
/** Obtain the NativeMethodEnvironment for this thread. */

‎vm/builtin/poly_inline_cache.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ namespace rubinius {
103103
Executable* meth = entry->method();
104104
Module* mod = entry->stored_module();
105105
entry->hit();
106+
state->vm()->metrics().machine.methods_invoked++;
106107

107108
return meth->execute(state, call_frame, meth, mod, args);
108109
}
@@ -126,6 +127,7 @@ namespace rubinius {
126127
Executable* meth = entry->method();
127128
Module* mod = entry->stored_module();
128129
entry->hit();
130+
state->vm()->metrics().machine.methods_invoked++;
129131

130132
return meth->execute(state, call_frame, meth, mod, args);
131133
}

‎vm/builtin/system.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ namespace rubinius {
805805
state->vm()->global_cache()->clear(state, name);
806806
mod->reset_method_cache(state, name);
807807

808-
state->vm()->metrics().system_metrics.vm_inline_cache_resets++;
808+
state->vm()->metrics().machine.inline_cache_resets++;
809809

810810
if(state->shared().config.ic_debug) {
811811
String* mod_name = mod->get_name(state);

‎vm/builtin/thread.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ namespace rubinius {
8484

8585
Thread* Thread::create(STATE, Object* self, ThreadFunction function) {
8686
VM* vm = state->shared().new_vm();
87-
vm->metrics().init(metrics::eRubyMetrics);
8887

8988
Thread* thr = Thread::create(state, as<Class>(self), vm);
9089

@@ -93,7 +92,7 @@ namespace rubinius {
9392
state->memory()->needs_finalization(thr, (FinalizerFunction)&Thread::finalize,
9493
FinalizeObject::eUnmanaged);
9594

96-
state->vm()->metrics().system_metrics.vm_threads_created++;
95+
state->vm()->metrics().system.threads_created++;
9796

9897
return thr;
9998
}

‎vm/console.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ namespace rubinius {
128128
req = new char[bytes+1];
129129
memcpy(req, buf, bytes);
130130
req[bytes] = 0;
131-
metrics().m.console_metrics.requests_received++;
131+
vm()->metrics().console.requests_received++;
132132
} else if(bytes < 0) {
133133
logger::error("%s: console: unable to read request", strerror(errno));
134134
}
@@ -270,7 +270,7 @@ namespace rubinius {
270270
logger::error("%s: console: unable to write response", strerror(errno));
271271
}
272272

273-
metrics().m.console_metrics.responses_sent++;
273+
vm()->metrics().console.responses_sent++;
274274
}
275275

276276
void Response::run(STATE) {

‎vm/drivers/jit-test.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ int main(int argc, char **argv) {
2323
ConfigParser * config = new ConfigParser;
2424
shared->user_config = config;
2525
VM* state = shared->new_vm();
26-
state->metrics()->init(metrics::eRubyMetrics);
2726

2827
state->initialize(VM::default_bytes);
2928
state->boot();

‎vm/environment.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ namespace rubinius {
104104
check_io_descriptors();
105105

106106
root_vm = shared->new_vm("rbx.ruby.main");
107-
root_vm->metrics().init(metrics::eRubyMetrics);
108107
state = new State(root_vm);
109108

110109
loader_ = new TypedRoot<Object*>(state);

‎vm/gc/finalize.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ namespace rubinius {
124124
void FinalizerThread::run(STATE) {
125125
GCTokenImpl gct;
126126

127-
metrics().init(metrics::eFinalizerMetrics);
128-
129127
state->gc_dependent(gct, 0);
130128

131129
while(!thread_exit_) {
@@ -260,7 +258,7 @@ namespace rubinius {
260258
process_list_ = NULL;
261259
process_item_kind_ = eRuby;
262260
lists_->pop_back();
263-
metrics().m.finalizer_metrics.objects_finalized++;
261+
vm()->metrics().gc.objects_finalized++;
264262
break;
265263
}
266264
}
@@ -321,7 +319,7 @@ namespace rubinius {
321319
// Makes a copy of fi.
322320
live_list_->push_front(fi);
323321

324-
metrics().m.finalizer_metrics.objects_queued++;
322+
vm()->metrics().gc.objects_queued++;
325323
}
326324

327325
void FinalizerThread::set_ruby_finalizer(Object* obj, Object* finalizer) {

‎vm/gc/immix.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace rubinius {
1919
#endif
2020

2121
if(object_memory_) {
22-
object_memory_->state()->metrics().m.ruby_metrics.memory_immix_chunks++;
22+
object_memory_->state()->metrics().memory.immix_chunks++;
2323

2424
if(gc_->dec_chunks_left() <= 0) {
2525
gc_->reset_chunks_left();

‎vm/gc/immix_marker.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,13 @@ namespace rubinius {
7373
void ImmixMarker::run(STATE) {
7474
GCTokenImpl gct;
7575

76-
metrics().init(metrics::eRubyMetrics);
77-
7876
state->gc_dependent(gct, 0);
7977

8078
while(!thread_exit_) {
8179
if(data_) {
8280
{
8381
timer::StopWatch<timer::milliseconds> timer(
84-
state->vm()->metrics().m.ruby_metrics.gc_immix_concurrent_ms);
82+
state->vm()->metrics().gc.immix_concurrent_ms);
8583

8684
// Allow for a young stop the world GC to occur
8785
// every bunch of marks. 100 is a fairly arbitrary
@@ -98,7 +96,7 @@ namespace rubinius {
9896

9997
{
10098
timer::StopWatch<timer::milliseconds> timer(
101-
state->vm()->metrics().m.ruby_metrics.gc_immix_stop_ms);
99+
state->vm()->metrics().gc.immix_stop_ms);
102100

103101
// Finish and pause
104102
while(!state->stop_the_world()) {

‎vm/gc/managed.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace rubinius {
1515
: shared_(ss)
1616
, run_state_(eIndependent)
1717
, kind_(kind)
18+
, metrics_()
1819
, os_thread_(pthread_self())
1920
, id_(id)
2021
{
@@ -25,8 +26,6 @@ namespace rubinius {
2526
thread_name << "rbx.ruby." << id_;
2627
name_ = thread_name.str();
2728
}
28-
29-
metrics_.init(metrics::eNone);
3029
}
3130

3231
ManagedThread::~ManagedThread() {

‎vm/gc/mark_sweep.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ namespace rubinius {
5353

5454
entries.push_back(obj);
5555

56-
object_memory_->state()->metrics().m.ruby_metrics.memory_large_objects++;
57-
object_memory_->state()->metrics().m.ruby_metrics.memory_large_bytes += bytes;
56+
object_memory_->state()->metrics().memory.large_objects++;
57+
object_memory_->state()->metrics().memory.large_bytes += bytes;
5858

5959
next_collection_bytes -= bytes;
6060
if(next_collection_bytes < 0) {
@@ -73,8 +73,8 @@ namespace rubinius {
7373

7474
last_freed++;
7575

76-
object_memory_->state()->metrics().m.ruby_metrics.memory_large_objects--;
77-
object_memory_->state()->metrics().m.ruby_metrics.memory_large_bytes -=
76+
object_memory_->state()->metrics().memory.large_objects--;
77+
object_memory_->state()->metrics().memory.large_bytes -=
7878
obj->size_in_bytes(object_memory_->state());
7979
}
8080

@@ -122,8 +122,7 @@ namespace rubinius {
122122
void MarkSweepGC::after_marked() {
123123
metrics::MetricsData& metrics = object_memory_->state()->metrics();
124124

125-
timer::StopWatch<timer::milliseconds> timer(
126-
metrics.m.ruby_metrics.gc_large_sweep_ms);
125+
timer::StopWatch<timer::microseconds> timer(metrics.gc.large_sweep_us);
127126

128127
last_freed = 0;
129128

‎vm/internal_threads.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ namespace rubinius {
1515
: vm_(state->shared().new_vm(name.c_str()))
1616
, thread_running_(false)
1717
, stack_size_(stack_size)
18-
, metrics_(vm_->metrics())
1918
, thread_exit_(false)
2019
{
2120
state->shared().internal_threads()->register_thread(this);

‎vm/internal_threads.hpp

-10
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,13 @@ namespace rubinius {
1010
class InternalThread;
1111
class VM;
1212

13-
namespace metrics {
14-
struct MetricsData;
15-
}
16-
1713
typedef std::list<InternalThread*> InternalThreadList;
1814

1915
class InternalThread {
2016
VM* vm_;
2117
bool thread_running_;
2218
uint32_t stack_size_;
2319

24-
metrics::MetricsData& metrics_;
25-
2620
protected:
2721

2822
bool thread_exit_;
@@ -57,10 +51,6 @@ namespace rubinius {
5751
return vm_;
5852
}
5953

60-
metrics::MetricsData& metrics() {
61-
return metrics_;
62-
}
63-
6454
virtual void initialize(STATE);
6555
virtual void start(STATE);
6656
virtual void start_thread(STATE);

0 commit comments

Comments
 (0)
Please sign in to comment.