diff options
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/comm.rs | 10 | ||||
| -rw-r--r-- | src/libstd/rt/metrics.rs | 98 | ||||
| -rw-r--r-- | src/libstd/rt/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/sched.rs | 5 |
4 files changed, 0 insertions, 115 deletions
diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index 5cd0d7b8b54..bd83e286156 100644 --- a/src/libstd/rt/comm.rs +++ b/src/libstd/rt/comm.rs @@ -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 diff --git a/src/libstd/rt/metrics.rs b/src/libstd/rt/metrics.rs deleted file mode 100644 index b0c0fa5d708..00000000000 --- a/src/libstd/rt/metrics.rs +++ /dev/null @@ -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 - ) - } -} \ No newline at end of file diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index ead0fb63793..0d59d5780cc 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -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; diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index 158a5e3cfe3..7d59627ba39 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -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); |
