std::rt: Remove metrics for perf

These aren't used for anything at the moment and cause some TLS hits
on some perf-critical code paths. Will need to put better thought into
it in the future.
This commit is contained in:
Brian Anderson 2013-08-17 21:50:37 -07:00
parent 0fff8b6549
commit a37bdde3f9
4 changed files with 0 additions and 115 deletions

View File

@ -144,16 +144,8 @@ impl<T> ChanOne<T> {
match oldstate {
STATE_BOTH => {
// Port is not waiting yet. Nothing to do
do Local::borrow::<Scheduler, ()> |sched| {
rtdebug!("non-rendezvous send");
sched.metrics.non_rendezvous_sends += 1;
}
}
STATE_ONE => {
do Local::borrow::<Scheduler, ()> |sched| {
rtdebug!("rendezvous send");
sched.metrics.rendezvous_sends += 1;
}
// Port has closed. Need to clean up.
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
recvr_active = false;
@ -251,7 +243,6 @@ impl<T> SelectInner for PortOne<T> {
STATE_BOTH => {
// Data has not been sent. Now we're blocked.
rtdebug!("non-rendezvous recv");
sched.metrics.non_rendezvous_recvs += 1;
false
}
STATE_ONE => {
@ -267,7 +258,6 @@ impl<T> SelectInner for PortOne<T> {
(*self.packet()).state.store(STATE_ONE, Relaxed);
rtdebug!("rendezvous recv");
sched.metrics.rendezvous_recvs += 1;
// Channel is closed. Switch back and check the data.
// NB: We have to drop back into the scheduler event loop here

View File

@ -1,98 +0,0 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use to_str::ToStr;
pub struct SchedMetrics {
// The number of times executing `run_sched_once`.
turns: uint,
// The number of turns that received a message.
messages_received: uint,
// The number of turns that ran a task from the queue.
tasks_resumed_from_queue: uint,
// The number of turns that found no work to perform.
wasted_turns: uint,
// The number of times the scheduler went to sleep.
sleepy_times: uint,
// Context switches from the scheduler into a task.
context_switches_sched_to_task: uint,
// Context switches from a task into the scheduler.
context_switches_task_to_sched: uint,
// Context switches from a task to a task.
context_switches_task_to_task: uint,
// Message sends that unblock the receiver
rendezvous_sends: uint,
// Message sends that do not unblock the receiver
non_rendezvous_sends: uint,
// Message receives that do not block the receiver
rendezvous_recvs: uint,
// Message receives that block the receiver
non_rendezvous_recvs: uint,
// JoinLatch releases that create tombstones
release_tombstone: uint,
// JoinLatch releases that do not create tombstones
release_no_tombstone: uint,
}
impl SchedMetrics {
pub fn new() -> SchedMetrics {
SchedMetrics {
turns: 0,
messages_received: 0,
tasks_resumed_from_queue: 0,
wasted_turns: 0,
sleepy_times: 0,
context_switches_sched_to_task: 0,
context_switches_task_to_sched: 0,
context_switches_task_to_task: 0,
rendezvous_sends: 0,
non_rendezvous_sends: 0,
rendezvous_recvs: 0,
non_rendezvous_recvs: 0,
release_tombstone: 0,
release_no_tombstone: 0
}
}
}
impl ToStr for SchedMetrics {
fn to_str(&self) -> ~str {
fmt!("turns: %u\n\
messages_received: %u\n\
tasks_resumed_from_queue: %u\n\
wasted_turns: %u\n\
sleepy_times: %u\n\
context_switches_sched_to_task: %u\n\
context_switches_task_to_sched: %u\n\
context_switches_task_to_task: %u\n\
rendezvous_sends: %u\n\
non_rendezvous_sends: %u\n\
rendezvous_recvs: %u\n\
non_rendezvous_recvs: %u\n\
release_tombstone: %u\n\
release_no_tombstone: %u\n\
",
self.turns,
self.messages_received,
self.tasks_resumed_from_queue,
self.wasted_turns,
self.sleepy_times,
self.context_switches_sched_to_task,
self.context_switches_task_to_sched,
self.context_switches_task_to_task,
self.rendezvous_sends,
self.non_rendezvous_sends,
self.rendezvous_recvs,
self.non_rendezvous_recvs,
self.release_tombstone,
self.release_no_tombstone
)
}
}

View File

@ -152,8 +152,6 @@ pub mod local_ptr;
/// Bindings to pthread/windows thread-local storage.
pub mod thread_local_storage;
pub mod metrics;
// FIXME #5248 shouldn't be pub
/// Just stuff
pub mod util;

View File

@ -24,7 +24,6 @@ use rt::kill::BlockedTask;
use rt::local_ptr;
use rt::local::Local;
use rt::rtio::{RemoteCallback, PausibleIdleCallback};
use rt::metrics::SchedMetrics;
use borrow::{to_uint};
use cell::Cell;
use rand::{XorShiftRng, RngUtil};
@ -71,7 +70,6 @@ pub struct Scheduler {
/// An action performed after a context switch on behalf of the
/// code running before the context switch
cleanup_job: Option<CleanupJob>,
metrics: SchedMetrics,
/// Should this scheduler run any task, or only pinned tasks?
run_anything: bool,
/// If the scheduler shouldn't run some tasks, a friend to send
@ -126,7 +124,6 @@ impl Scheduler {
stack_pool: StackPool::new(),
sched_task: None,
cleanup_job: None,
metrics: SchedMetrics::new(),
run_anything: run_anything,
friend_handle: friend,
rng: XorShiftRng::new(),
@ -267,10 +264,8 @@ impl Scheduler {
// If we got here then there was no work to do.
// Generate a SchedHandle and push it to the sleeper list so
// somebody can wake us up later.
sched.metrics.wasted_turns += 1;
if !sched.sleepy && !sched.no_sleep {
rtdebug!("scheduler has no work to do, going to sleep");
sched.metrics.sleepy_times += 1;
sched.sleepy = true;
let handle = sched.make_handle();
sched.sleeper_list.push(handle);