-
-
Save GuillaumeGomez/b5cd86c82979d9506b52af25b83b723c to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
This file contains hidden or 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
/* | |
* Command line: opannotate --source | |
* | |
* Interpretation of command line: | |
* Output annotated source file with samples | |
* Output all files | |
* | |
* CPU: Intel Ivy Bridge microarchitecture, speed 3.3e+06 MHz (estimated) | |
* Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 100000 | |
*/ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/crc-1.4.0/src/crc32.rs" | |
* | |
* 2796527 29.3630 | |
*/ | |
:use std::hash::Hasher; | |
: | |
:pub const CASTAGNOLI: u32 = 0x82f63b78; | |
:pub const IEEE: u32 = 0xedb88320; | |
:pub const KOOPMAN: u32 = 0xeb31d82e; | |
: | |
:lazy_static! { | |
: pub static ref IEEE_TABLE: [u32; 256] = make_table(IEEE); | |
: pub static ref CASTAGNOLI_TABLE: [u32; 256] = make_table(CASTAGNOLI); | |
: pub static ref KOOPMAN_TABLE: [u32; 256] = make_table(KOOPMAN); | |
:} | |
: | |
:pub struct Digest { | |
: table: [u32; 256], | |
: initial: u32, | |
: value: u32 | |
:} | |
: | |
:pub trait Hasher32 { | |
: fn reset(&mut self); | |
: fn write(&mut self, bytes: &[u8]); | |
: fn sum32(&self) -> u32; | |
:} | |
: | |
:pub fn make_table(poly: u32) -> [u32; 256] { | |
: let mut table = [0u32; 256]; | |
: for i in 0..256 { | |
: let mut value = i as u32; | |
: for _ in 0..8 { | |
146 0.0015 : value = if (value & 1) == 1 { | |
38 4.0e-04 : (value >> 1) ^ poly | |
: } else { | |
: value >> 1 | |
: } | |
: } | |
9 9.4e-05 : table[i] = value; | |
: } | |
1 1.0e-05 : table | |
:} | |
: | |
:pub fn update(mut value: u32, table: &[u32; 256], bytes: &[u8]) -> u32 { | |
1801 0.0189 : value = !value; | |
: for &i in bytes.iter() { | |
2792989 29.3259 : value = table[((value as u8) ^ i) as usize] ^ (value >> 8) | |
: } | |
19 2.0e-04 : !value | |
:} | |
: | |
:pub fn checksum_ieee(bytes: &[u8]) -> u32 { | |
: return update(0, &IEEE_TABLE, bytes); | |
:} | |
: | |
:pub fn checksum_castagnoli(bytes: &[u8]) -> u32 { | |
: return update(0, &CASTAGNOLI_TABLE, bytes); | |
:} | |
: | |
:pub fn checksum_koopman(bytes: &[u8]) -> u32 { | |
: return update(0, &KOOPMAN_TABLE, bytes); | |
:} | |
: | |
:impl Digest { | |
12 1.3e-04 : pub fn new(poly: u32) -> Digest { /* crc::crc32::Digest::new::he1a9ee37593052fd total: 241 0.0025 */ | |
2 2.1e-05 : Digest { | |
: table: make_table(poly), | |
: initial: 0, | |
: value: 0 | |
: } | |
1 1.0e-05 : } | |
: | |
: pub fn new_with_initial(poly: u32, initial: u32) -> Digest { | |
: Digest { | |
: table: make_table(poly), | |
: initial: initial, | |
: value: initial | |
: } | |
: } | |
:} | |
: | |
:impl Hasher32 for Digest { | |
: fn reset(&mut self) { | |
: self.value = self.initial; | |
: } | |
801 0.0084 : fn write(&mut self, bytes: &[u8]) { /* _$LT$crc..crc32..Digest$u20$as$u20$crc..crc32..Hasher32$GT$::write::h6f6529d62b71b991 total: 3569279 37.4768 */ | |
123 0.0013 : self.value = update(self.value, &self.table, bytes); | |
584 0.0061 : } | |
1 1.0e-05 : fn sum32(&self) -> u32 { /* _$LT$crc..crc32..Digest$u20$as$u20$crc..crc32..Hasher32$GT$::sum32::he1c056a2ae43d524 total: 1 1.0e-05 */ | |
: self.value | |
: } | |
:} | |
: | |
:/// Implementation of std::hash::Hasher so that types which #[derive(Hash)] can hash with Digest. | |
:impl Hasher for Digest { | |
: fn write(&mut self, bytes: &[u8]) { | |
: Hasher32::write(self, bytes); | |
: } | |
: | |
: fn finish(&self) -> u64 { | |
: self.sum32() as u64 | |
: } | |
:} | |
/* | |
* Total samples for file : "/checkout/src/libcore/slice.rs" | |
* | |
* 657206 6.9005 | |
*/ | |
/* _$LT$core..slice..RSplitN$LT$$u27$a$C$$u20$T$C$$u20$P$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h1b51d22a0a3d06bf total: 73 7.7e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/ptr.rs" | |
* | |
* 126497 1.3282 | |
*/ | |
/* | |
* Total samples for file : "ValueTracking.cpp" | |
* | |
* 82596 0.8672 | |
*/ | |
<credited to line zero> 82596 0.8672 : | |
/* computeKnownBitsFromOperator(llvm::Operator*, llvm::APInt&, llvm::APInt&, unsigned int, (anonymous namespace)::Query const&)::{lambda(llvm::APInt const&, unsigned int)#3}::operator()(llvm::APInt const&, unsigned int) const total: 121 0.0013 */ | |
/* computeKnownBitsFromOperator(llvm::Operator*, llvm::APInt&, llvm::APInt&, unsigned int, (anonymous namespace)::Query const&)::{lambda(llvm::APInt const&, unsigned int)#1}::operator()(llvm::APInt const&, unsigned int) const total: 181 0.0019 */ | |
/* isKnownNonZero(llvm::Value*, unsigned int, (anonymous namespace)::Query const&)::{lambda(llvm::Value*)#1}::operator()(llvm::Value*) const [clone .isra.369] total: 52 5.5e-04 */ | |
/* llvm::Optional<bool>::operator=(bool&&) [clone .isra.215] total: 14 1.5e-04 */ | |
/* computeKnownBitsFromAssume(llvm::Value*, llvm::APInt&, llvm::APInt&, unsigned int, (anonymous namespace)::Query const&) total: 30400 0.3192 */ | |
/* computeKnownBitsAddSub(bool, llvm::Value*, llvm::Value*, bool, llvm::APInt&, llvm::APInt&, llvm::APInt&, llvm::APInt&, unsigned int, (anonymous namespace)::Query const&) total: 2602 0.0273 */ | |
/* computeKnownBitsMul(llvm::Value*, llvm::Value*, bool, llvm::APInt&, llvm::APInt&, llvm::APInt&, llvm::APInt&, unsigned int, (anonymous namespace)::Query const&) total: 52 5.5e-04 */ | |
/* isTruePredicate(llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*, llvm::DataLayout const&, unsigned int, llvm::AssumptionCache*, llvm::Instruction const*, llvm::DominatorTree const*) total: 6 6.3e-05 */ | |
/* (anonymous namespace)::Query::Query((anonymous namespace)::Query const&, llvm::Value const*) total: 16 1.7e-04 */ | |
/* llvm::User::getOperand(unsigned int) const [clone .constprop.657] total: 1164 0.0122 */ | |
/* llvm::User::getOperand(unsigned int) const [clone .constprop.656] total: 1925 0.0202 */ | |
/* llvm::Operator::getOpcode(llvm::Value const*) [clone .part.364] total: 324 0.0034 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.658] total: 900 0.0094 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.659] total: 2391 0.0251 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.660] total: 58 6.1e-04 */ | |
/* safeCxtI(llvm::Value const*, llvm::Instruction const*) [clone .part.266] total: 242 0.0025 */ | |
/* isAssumeLikeIntrinsic(llvm::Instruction const*) total: 8 8.4e-05 */ | |
/* lookThroughCast(llvm::CmpInst*, llvm::Value*, llvm::Value*, llvm::Instruction::CastOps*) total: 5 5.2e-05 */ | |
/* matchSelectPattern(llvm::CmpInst::Predicate, llvm::FastMathFlags, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*&, llvm::Value*&) total: 59 6.2e-04 */ | |
/* isEphemeralValueOf(llvm::Instruction*, llvm::Value const*) total: 52 5.5e-04 */ | |
/* computeKnownBits(llvm::Value*, llvm::APInt&, llvm::APInt&, unsigned int, (anonymous namespace)::Query const&) total: 38621 0.4055 */ | |
/* ComputeNumSignBits(llvm::Value*, unsigned int, (anonymous namespace)::Query const&) total: 661 0.0069 */ | |
/* ComputeSignBit(llvm::Value*, bool&, bool&, unsigned int, (anonymous namespace)::Query const&) total: 185 0.0019 */ | |
/* isKnownToBeAPowerOfTwo(llvm::Value*, bool, unsigned int, (anonymous namespace)::Query const&) [clone .part.639] total: 12 1.3e-04 */ | |
/* isKnownToBeAPowerOfTwo(llvm::Value*, bool, unsigned int, (anonymous namespace)::Query const&) total: 28 2.9e-04 */ | |
/* isKnownNonZero(llvm::Value*, unsigned int, (anonymous namespace)::Query const&) total: 1891 0.0199 */ | |
/* isAddOfNonZero(llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&) total: 626 0.0066 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/string/../sysdeps/x86_64/memset.S" | |
* | |
* 69533 0.7301 | |
*/ | |
/* memset total: 69533 0.7301 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/sync/atomic.rs" | |
* | |
* 62959 0.6611 | |
*/ | |
/* std::sys_common::cleanup::hf76647b047efca1c total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/tcache.h" | |
* | |
* 62852 0.6599 | |
*/ | |
/* | |
* Total samples for file : "/checkout/src/liballoc/arc.rs" | |
* | |
* 51862 0.5445 | |
*/ | |
/* drop::h0c076004763eccbe total: 1 1.0e-05 */ | |
/* drop::h82fdfcfc7b6c3d2a total: 16714 0.1755 */ | |
/* drop::h23b28731e365fcc7 total: 4382 0.0460 */ | |
/* drop::h8c861b4fb13ddb4c total: 3806 0.0400 */ | |
/* _$LT$alloc..arc..Arc$LT$T$GT$$GT$::drop_slow::h0ab2880724562149 total: 1 1.0e-05 */ | |
/* _$LT$alloc..arc..Arc$LT$T$GT$$GT$::drop_slow::h0d83887ac9fb32a2 total: 4357 0.0457 */ | |
/* _$LT$alloc..arc..Arc$LT$T$GT$$GT$::drop_slow::h3eb267b0b79ca45c total: 7 7.3e-05 */ | |
/* _$LT$alloc..arc..Arc$LT$T$GT$$GT$::drop_slow::hcc379690ea8f6bcf total: 10 1.0e-04 */ | |
/* _$LT$alloc..arc..Arc$LT$T$GT$$GT$::drop_slow::haa9b0b5ac9552883 total: 47 4.9e-04 */ | |
/* _$LT$alloc..arc..Arc$LT$T$GT$$GT$::drop_slow::he54a58b53863ac67 total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c" | |
* | |
* 50102 0.5261 | |
*/ | |
/* jemalloc_constructor total: 1 1.0e-05 */ | |
/* a0idalloc total: 1 1.0e-05 */ | |
/* je_arena_tdata_get_hard total: 1 1.0e-05 */ | |
/* je_arena_choose_hard total: 4 4.2e-05 */ | |
/* malloc_conf_init total: 1 1.0e-05 */ | |
/* malloc total: 24707 0.2594 */ | |
/* calloc total: 1 1.0e-05 */ | |
/* calloc total: 608 0.0064 */ | |
/* realloc total: 589 0.0062 */ | |
/* free total: 1 1.0e-05 */ | |
/* free total: 30200 0.3171 */ | |
/* mallocx total: 25270 0.2653 */ | |
/* mallocx total: 23866 0.2506 */ | |
/* rallocx total: 1 1.0e-05 */ | |
/* rallocx total: 225 0.0024 */ | |
/* rallocx total: 4439 0.0466 */ | |
/* xallocx total: 20 2.1e-04 */ | |
/* sdallocx total: 39607 0.4159 */ | |
/* sdallocx total: 21271 0.2233 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/string/../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S" | |
* | |
* 48096 0.5050 | |
*/ | |
/* __memmove_ssse3_back total: 48095 0.5050 */ | |
/* __memcpy_ssse3_back total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/nptl/pthread_mutex_unlock.c" | |
* | |
* 46226 0.4854 | |
*/ | |
/* pthread_mutex_unlock total: 46226 0.4854 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/sync/mpsc/mod.rs" | |
* | |
* 43809 0.4600 | |
*/ | |
://! A multi-producer, single-consumer, futures-aware, FIFO queue with back pressure. | |
://! | |
://! A channel can be used as a communication primitive between tasks running on | |
://! `futures-rs` executors. Channel creation provides `Receiver` and `Sender` | |
://! handles. `Receiver` implements `Stream` and allows a task to read values | |
://! out of the channel. If there is no message to read from the channel, the | |
://! current task will be notified when a new value is sent. `Sender` implements | |
://! the `Sink` trait and allows a task to send messages into the channel. If | |
://! the channel is at capacity, then send will be rejected and the task will be | |
://! notified when additional capacity is available. | |
://! | |
://! # Disconnection | |
://! | |
://! When all `Sender` handles have been dropped, it is no longer possible to | |
://! send values into the channel. This is considered the termination event of | |
://! the stream. As such, `Sender::poll` will return `Ok(Ready(None))`. | |
://! | |
://! If the receiver handle is dropped, then messages can no longer be read out | |
://! of the channel. In this case, a `send` will result in an error. | |
://! | |
://! # Clean Shutdown | |
://! | |
://! If the `Receiver` is simply dropped, then it is possible for there to be | |
://! messages still in the channel that will not be processed. As such, it is | |
://! usually desirable to perform a "clean" shutdown. To do this, the receiver | |
://! will first call `close`, which will prevent any further messages to be sent | |
://! into the channel. Then, the receiver consumes the channel to completion, at | |
://! which point the receiver can be dropped. | |
: | |
:// At the core, the channel uses an atomic FIFO queue for message passing. This | |
:// queue is used as the primary coordination primitive. In order to enforce | |
:// capacity limits and handle back pressure, a secondary FIFO queue is used to | |
:// send parked task handles. | |
:// | |
:// The general idea is that the channel is created with a `buffer` size of `n`. | |
:// The channel capacity is `n + num-senders`. Each sender gets one "guaranteed" | |
:// slot to hold a message. This allows `Sender` to know for a fact that a send | |
:// will succeed *before* starting to do the actual work of sending the value. | |
:// Since most of this work is lock-free, once the work starts, it is impossible | |
:// to safely revert. | |
:// | |
:// If the sender is unable to process a send operation, then the the curren | |
:// task is parked and the handle is sent on the parked task queue. | |
:// | |
:// Note that the implementation guarantees that the channel capacity will never | |
:// exceed the configured limit, however there is no *strict* guarantee that the | |
:// receiver will wake up a parked task *immediately* when a slot becomes | |
:// available. However, it will almost always unpark a task when a slot becomes | |
:// available and it is *guaranteed* that a sender will be unparked when the | |
:// message that caused the sender to become parked is read out of the channel. | |
:// | |
:// The steps for sending a message are roughly: | |
:// | |
:// 1) Increment the channel message count | |
:// 2) If the channel is at capacity, push the task handle onto the wait queue | |
:// 3) Push the message onto the message queue. | |
:// | |
:// The steps for receiving a message are roughly: | |
:// | |
:// 1) Pop a message from the message queue | |
:// 2) Pop a task handle from the wait queue | |
:// 3) Decrement the channel message count. | |
:// | |
:// It's important for the order of operations on lock-free structures to happen | |
:// in reverse order between the sender and receiver. This makes the message | |
:// queue the primary coordination structure and establishes the necessary | |
:// happens-before semantics required for the acquire / release semantics used | |
:// by the queue structure. | |
: | |
:use std::fmt; | |
:use std::error::Error; | |
:use std::any::Any; | |
:use std::sync::atomic::AtomicUsize; | |
:use std::sync::atomic::Ordering::SeqCst; | |
:use std::sync::{Arc, Mutex}; | |
:use std::thread; | |
:use std::usize; | |
: | |
:use sync::mpsc::queue::{Queue, PopResult}; | |
:use task::{self, Task}; | |
:use {Async, AsyncSink, Poll, StartSend, Sink, Stream}; | |
: | |
:mod queue; | |
: | |
:/// The transmission end of a channel which is used to send values. | |
:/// | |
:/// This is created by the `channel` method. | |
:pub struct Sender<T> { | |
: // Channel state shared between the sender and receiver. | |
: inner: Arc<Inner<T>>, | |
: | |
: // Handle to the task that is blocked on this sender. This handle is sent | |
: // to the receiver half in order to be notified when the sender becomes | |
: // unblocked. | |
: sender_task: SenderTask, | |
: | |
: // True if the sender might be blocked. This is an optimization to avoid | |
: // having to lock the mutex most of the time. | |
: maybe_parked: bool, | |
:} | |
: | |
:/// The transmission end of a channel which is used to send values. | |
:/// | |
:/// This is created by the `unbounded` method. | |
:pub struct UnboundedSender<T>(Sender<T>); | |
: | |
:fn _assert_kinds() { | |
: fn _assert_send<T: Send>() {} | |
: fn _assert_sync<T: Sync>() {} | |
: fn _assert_clone<T: Clone>() {} | |
: _assert_send::<UnboundedSender<u32>>(); | |
: _assert_sync::<UnboundedSender<u32>>(); | |
: _assert_clone::<UnboundedSender<u32>>(); | |
:} | |
: | |
: | |
:/// The receiving end of a channel which implements the `Stream` trait. | |
:/// | |
:/// This is a concrete implementation of a stream which can be used to represent | |
:/// a stream of values being computed elsewhere. This is created by the | |
:/// `channel` method. | |
:pub struct Receiver<T> { | |
: inner: Arc<Inner<T>>, | |
:} | |
: | |
:/// The receiving end of a channel which implements the `Stream` trait. | |
:/// | |
:/// This is a concrete implementation of a stream which can be used to represent | |
:/// a stream of values being computed elsewhere. This is created by the | |
:/// `unbounded` method. | |
:pub struct UnboundedReceiver<T>(Receiver<T>); | |
: | |
:/// Error type for sending, used when the receiving end of a channel is | |
:/// dropped | |
:pub struct SendError<T>(T); | |
: | |
:impl<T> fmt::Debug for SendError<T> { | |
: fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
: fmt.debug_tuple("SendError") | |
: .field(&"...") | |
: .finish() | |
: } | |
:} | |
: | |
:impl<T> fmt::Display for SendError<T> { | |
: fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
: write!(fmt, "send failed because receiver is gone") | |
: } | |
:} | |
: | |
:impl<T: Any> Error for SendError<T> | |
:{ | |
: fn description(&self) -> &str { | |
: "send failed because receiver is gone" | |
: } | |
:} | |
: | |
:impl<T> SendError<T> { | |
: /// Returns the message that was attempted to be sent but failed. | |
: pub fn into_inner(self) -> T { | |
: self.0 | |
: } | |
:} | |
: | |
:struct Inner<T> { | |
: // Max buffer size of the channel. If `None` then the channel is unbounded. | |
: buffer: Option<usize>, | |
: | |
: // Internal channel state. Consists of the number of messages stored in the | |
: // channel as well as a flag signalling that the channel is closed. | |
: state: AtomicUsize, | |
: | |
: // Atomic, FIFO queue used to send messages to the receiver | |
: message_queue: Queue<Option<T>>, | |
: | |
: // Atomic, FIFO queue used to send parked task handles to the receiver. | |
: parked_queue: Queue<SenderTask>, | |
: | |
: // Number of senders in existence | |
: num_senders: AtomicUsize, | |
: | |
: // Handle to the receiver's task. | |
: recv_task: Mutex<ReceiverTask>, | |
:} | |
: | |
:// Struct representation of `Inner::state`. | |
:#[derive(Debug, Clone, Copy)] | |
:struct State { | |
: // `true` when the channel is open | |
: is_open: bool, | |
: | |
: // Number of messages in the channel | |
: num_messages: usize, | |
:} | |
: | |
:struct ReceiverTask { | |
: unparked: bool, | |
: task: Option<Task>, | |
:} | |
: | |
:// Returned from Receiver::try_park() | |
:enum TryPark { | |
: Parked, | |
: Closed, | |
: NotEmpty, | |
:} | |
: | |
:// The `is_open` flag is stored in the left-most bit of `Inner::state` | |
:const OPEN_MASK: usize = 1 << 31; | |
: | |
:// When a new channel is created, it is created in the open state with no | |
:// pending messages. | |
:const INIT_STATE: usize = OPEN_MASK; | |
: | |
:// The maximum number of messages that a channel can track is `usize::MAX > 1` | |
:const MAX_CAPACITY: usize = !(OPEN_MASK); | |
: | |
:// The maximum requested buffer size must be less than the maximum capacity of | |
:// a channel. This is because each sender gets a guaranteed slot. | |
:const MAX_BUFFER: usize = MAX_CAPACITY >> 1; | |
: | |
:// Sent to the consumer to wake up blocked producers | |
:type SenderTask = Arc<Mutex<Option<Task>>>; | |
: | |
:/// Creates an in-memory channel implementation of the `Stream` trait with | |
:/// bounded capacity. | |
:/// | |
:/// This method creates a concrete implementation of the `Stream` trait which | |
:/// can be used to send values across threads in a streaming fashion. This | |
:/// channel is unique in that it implements back pressure to ensure that the | |
:/// sender never outpaces the receiver. The channel capacity is equal to | |
:/// `buffer + num-senders`. In other words, each sender gets a guaranteed slot | |
:/// in the channel capacity, and on top of that there are `buffer` "first come, | |
:/// first serve" slots available to all senders. | |
:/// | |
:/// The `Receiver` returned implements the `Stream` trait and has access to any | |
:/// number of the associated combinators for transforming the result. | |
:pub fn channel<T>(buffer: usize) -> (Sender<T>, Receiver<T>) { | |
: // Check that the requested buffer size does not exceed the maximum buffer | |
: // size permitted by the system. | |
: assert!(buffer < MAX_BUFFER, "requested buffer size too large"); | |
: channel2(Some(buffer)) | |
:} | |
: | |
:/// Creates an in-memory channel implementation of the `Stream` trait with | |
:/// unbounded capacity. | |
:/// | |
:/// This method creates a concrete implementation of the `Stream` trait which | |
:/// can be used to send values across threads in a streaming fashion. A `send` | |
:/// on this channel will always succeed as long as the receive half has not | |
:/// been closed. If the receiver falls behind, messages will be buffered | |
:/// internally. | |
:/// | |
:/// **Note** that the amount of available system memory is an implicit bound to | |
:/// the channel. Using an `unbounded` channel has the ability of causing the | |
:/// process to run out of memory. In this case, the process will be aborted. | |
:pub fn unbounded<T>() -> (UnboundedSender<T>, UnboundedReceiver<T>) { | |
: let (tx, rx) = channel2(None); | |
: (UnboundedSender(tx), UnboundedReceiver(rx)) | |
:} | |
: | |
:fn channel2<T>(buffer: Option<usize>) -> (Sender<T>, Receiver<T>) { | |
: let inner = Arc::new(Inner { | |
: buffer: buffer, | |
: state: AtomicUsize::new(INIT_STATE), | |
: message_queue: Queue::new(), | |
: parked_queue: Queue::new(), | |
: num_senders: AtomicUsize::new(1), | |
: recv_task: Mutex::new(ReceiverTask { | |
: unparked: false, | |
: task: None, | |
: }), | |
: }); | |
: | |
: let tx = Sender { | |
: inner: inner.clone(), | |
: sender_task: Arc::new(Mutex::new(None)), | |
: maybe_parked: false, | |
: }; | |
: | |
: let rx = Receiver { | |
: inner: inner, | |
: }; | |
: | |
: (tx, rx) | |
:} | |
: | |
:/* | |
: * | |
: * ===== impl Sender ===== | |
: * | |
: */ | |
: | |
:impl<T> Sender<T> { | |
: // Do the send without failing | |
3790 0.0398 : fn do_send(&mut self, msg: Option<T>, can_park: bool) -> Result<(), SendError<T>> { /* _$LT$futures..sync..mpsc..Sender$LT$T$GT$$GT$::do_send::hfc52f4c968618717 total: 26685 0.2802 */ | |
: // First, increment the number of messages contained by the channel. | |
: // This operation will also atomically determine if the sender task | |
: // should be parked. | |
: // | |
: // None is returned in the case that the channel has been closed by the | |
: // receiver. This happens when `Receiver::close` is called or the | |
: // receiver is dropped. | |
262 0.0028 : let park_self = match self.inc_num_messages(msg.is_none()) { | |
: Some(park_self) => park_self, | |
: None => { | |
: // The receiver has closed the channel. Only abort if actually | |
: // sending a message. It is important that the stream | |
: // termination (None) is always sent. This technically means | |
: // that it is possible for the queue to contain the following | |
: // number of messages: | |
: // | |
: // num-senders + buffer + 1 | |
: // | |
: if let Some(msg) = msg { | |
: return Err(SendError(msg)); | |
: } else { | |
: return Ok(()); | |
: } | |
: } | |
: }; | |
: | |
: // If the channel has reached capacity, then the sender task needs to | |
: // be parked. This will send the task handle on the parked task queue. | |
: // | |
: // However, when `do_send` is called while dropping the `Sender`, | |
: // `task::park()` can't be called safely. In this case, in order to | |
: // maintain internal consistency, a blank message is pushed onto the | |
: // parked task queue. | |
: if park_self { | |
262 0.0028 : self.park(can_park); | |
: } | |
: | |
42 4.4e-04 : self.queue_push_and_signal(msg); | |
: | |
127 0.0013 : Ok(()) | |
353 0.0037 : } | |
: | |
: // Do the send without parking current task. | |
: // | |
: // To be called from unbounded sender. | |
3 3.1e-05 : fn do_send_nb(&self, msg: T) -> Result<(), SendError<T>> { | |
: match self.inc_num_messages(false) { | |
: Some(park_self) => assert!(!park_self), | |
: None => return Err(SendError(msg)), | |
: }; | |
: | |
2 2.1e-05 : self.queue_push_and_signal(Some(msg)); | |
: | |
1 1.0e-05 : Ok(()) | |
: } | |
: | |
: // Push message to the queue and signal to the receiver | |
1 1.0e-05 : fn queue_push_and_signal(&self, msg: Option<T>) { /* _$LT$futures..sync..mpsc..Sender$LT$T$GT$$GT$::queue_push_and_signal::h74edd11d1c3f25fb total: 158 0.0017 */ | |
: // Push the message onto the message queue | |
: self.inner.message_queue.push(msg); | |
: | |
: // Signal to the receiver that a message has been enqueued. If the | |
: // receiver is parked, this will unpark the task. | |
228 0.0024 : self.signal(); | |
: } | |
: | |
: // Increment the number of queued messages. Returns if the sender should | |
: // block. | |
14 1.5e-04 : fn inc_num_messages(&self, close: bool) -> Option<bool> { /* _$LT$futures..sync..mpsc..Sender$LT$T$GT$$GT$::inc_num_messages::h2ff22f1f1f7b5b02 total: 47 4.9e-04 */ | |
: let mut curr = self.inner.state.load(SeqCst); | |
: | |
: loop { | |
135 0.0014 : let mut state = decode_state(curr); | |
: | |
: // The receiver end closed the channel. | |
291 0.0031 : if !state.is_open { | |
: return None; | |
: } | |
: | |
: // This probably is never hit? Odds are the process will run out of | |
: // memory first. It may be worth to return something else in this | |
: // case? | |
82 8.6e-04 : assert!(state.num_messages < MAX_CAPACITY, "buffer space exhausted; \ | |
: sending this messages would overflow the state"); | |
: | |
38 4.0e-04 : state.num_messages += 1; | |
: | |
: // The channel is closed by all sender handles being dropped. | |
: if close { | |
: state.is_open = false; | |
: } | |
: | |
140 0.0015 : let next = encode_state(&state); | |
: match self.inner.state.compare_exchange(curr, next, SeqCst, SeqCst) { | |
: Ok(_) => { | |
: // Block if the current number of pending messages has exceeded | |
: // the configured buffer size | |
: let park_self = match self.inner.buffer { | |
440 0.0046 : Some(buffer) => state.num_messages > buffer, | |
: None => false, | |
: }; | |
: | |
: return Some(park_self) | |
: } | |
: Err(actual) => curr = actual, | |
: } | |
: } | |
2 2.1e-05 : } | |
: | |
: // Signal to the receiver task that a message has been enqueued | |
: fn signal(&self) { | |
: // TODO | |
: // This logic can probably be improved by guarding the lock with an | |
: // atomic. | |
: // | |
: // Do this step first so that the lock is dropped when | |
: // `unpark` is called | |
: let task = { | |
104 0.0011 : let mut recv_task = self.inner.recv_task.lock().unwrap(); | |
: | |
: // If the receiver has already been unparked, then there is nothing | |
: // more to do | |
23 2.4e-04 : if recv_task.unparked { | |
: return; | |
: } | |
: | |
: // Setting this flag enables the receiving end to detect that | |
: // an unpark event happened in order to avoid unecessarily | |
: // parking. | |
117 0.0012 : recv_task.unparked = true; | |
: recv_task.task.take() | |
: }; | |
: | |
522 0.0055 : if let Some(task) = task { | |
43 4.5e-04 : task.unpark(); | |
115 0.0012 : } | |
: } | |
: | |
: fn park(&mut self, can_park: bool) { | |
: // TODO: clean up internal state if the task::park will fail | |
: | |
: let task = if can_park { | |
2309 0.0242 : Some(task::park()) | |
: } else { | |
: None | |
: }; | |
: | |
1263 0.0133 : *self.sender_task.lock().unwrap() = task; | |
: | |
: // Send handle over queue | |
: let t = self.sender_task.clone(); | |
: self.inner.parked_queue.push(t); | |
: | |
: // Check to make sure we weren't closed after we sent our task on the | |
: // queue | |
54 5.7e-04 : let state = decode_state(self.inner.state.load(SeqCst)); | |
262 0.0028 : self.maybe_parked = state.is_open; | |
: } | |
: | |
: fn poll_unparked(&mut self) -> Async<()> { | |
: // First check the `maybe_parked` variable. This avoids acquiring the | |
: // lock in most cases | |
898 0.0094 : if self.maybe_parked { | |
: // Get a lock on the task handle | |
: let mut task = self.sender_task.lock().unwrap(); | |
: | |
410 0.0043 : if task.is_none() { | |
146 0.0015 : self.maybe_parked = false; | |
: return Async::Ready(()) | |
: } | |
: | |
: // At this point, an unpark request is pending, so there will be an | |
: // unpark sometime in the future. We just need to make sure that | |
: // the correct task will be notified. | |
: // | |
: // Update the task in case the `Sender` has been moved to another | |
: // task | |
3514 0.0369 : *task = Some(task::park()); | |
: | |
: Async::NotReady | |
: } else { | |
: Async::Ready(()) | |
: } | |
: } | |
:} | |
: | |
:impl<T> Sink for Sender<T> { | |
: type SinkItem = T; | |
: type SinkError = SendError<T>; | |
: | |
2953 0.0310 : fn start_send(&mut self, msg: T) -> StartSend<T, SendError<T>> { /* _$LT$futures..sync..mpsc..Sender$LT$T$GT$$u20$as$u20$futures..sink..Sink$GT$::start_send::hae745c6f5a276602 total: 15511 0.1629 */ | |
: // If the sender is currently blocked, reject the message before doing | |
: // any work. | |
97 0.0010 : if !self.poll_unparked().is_ready() { | |
526 0.0055 : return Ok(AsyncSink::NotReady(msg)); | |
: } | |
: | |
: // The channel has capacity to accept the message, so send it. | |
475 0.0050 : try!(self.do_send(Some(msg), true)); | |
: | |
28 2.9e-04 : Ok(AsyncSink::Ready) | |
1661 0.0174 : } | |
: | |
: fn poll_complete(&mut self) -> Poll<(), SendError<T>> { | |
: Ok(Async::Ready(())) | |
: } | |
:} | |
: | |
:impl<T> UnboundedSender<T> { | |
: /// Sends the provided message along this channel. | |
: /// | |
: /// This is an unbounded sender, so this function differs from `Sink::send` | |
: /// by ensuring the return type reflects that the channel is always ready to | |
: /// receive messages. | |
: pub fn send(&self, msg: T) -> Result<(), SendError<T>> { | |
: self.0.do_send_nb(msg) | |
: } | |
:} | |
: | |
:impl<T> Sink for UnboundedSender<T> { | |
: type SinkItem = T; | |
: type SinkError = SendError<T>; | |
: | |
: fn start_send(&mut self, msg: T) -> StartSend<T, SendError<T>> { | |
: self.0.start_send(msg) | |
: } | |
: | |
: fn poll_complete(&mut self) -> Poll<(), SendError<T>> { | |
: self.0.poll_complete() | |
: } | |
:} | |
: | |
:impl<'a, T> Sink for &'a UnboundedSender<T> { | |
: type SinkItem = T; | |
: type SinkError = SendError<T>; | |
: | |
: fn start_send(&mut self, msg: T) -> StartSend<T, SendError<T>> { | |
: try!(self.0.do_send_nb(msg)); | |
: Ok(AsyncSink::Ready) | |
: } | |
: | |
: fn poll_complete(&mut self) -> Poll<(), SendError<T>> { | |
: Ok(Async::Ready(())) | |
: } | |
:} | |
: | |
:impl<T> Clone for UnboundedSender<T> { | |
: fn clone(&self) -> UnboundedSender<T> { | |
: UnboundedSender(self.0.clone()) | |
: } | |
:} | |
: | |
: | |
:impl<T> Clone for Sender<T> { | |
: fn clone(&self) -> Sender<T> { | |
: // Since this atomic op isn't actually guarding any memory and we don't | |
: // care about any orderings besides the ordering on the single atomic | |
: // variable, a relaxed ordering is acceptable. | |
: let mut curr = self.inner.num_senders.load(SeqCst); | |
: | |
: loop { | |
: // If the maximum number of senders has been reached, then fail | |
: if curr == self.inner.max_senders() { | |
: panic!("cannot clone `Sender` -- too many outstanding senders"); | |
: } | |
: | |
: debug_assert!(curr < self.inner.max_senders()); | |
: | |
: let next = curr + 1; | |
: let actual = self.inner.num_senders.compare_and_swap(curr, next, SeqCst); | |
: | |
: // The ABA problem doesn't matter here. We only care that the | |
: // number of senders never exceeds the maximum. | |
: if actual == curr { | |
: return Sender { | |
: inner: self.inner.clone(), | |
: sender_task: Arc::new(Mutex::new(None)), | |
: maybe_parked: false, | |
: }; | |
: } | |
: | |
: curr = actual; | |
: } | |
: } | |
:} | |
: | |
:impl<T> Drop for Sender<T> { | |
: fn drop(&mut self) { | |
: // Ordering between variables don't matter here | |
: let prev = self.inner.num_senders.fetch_sub(1, SeqCst); | |
: | |
3 3.1e-05 : if prev == 1 { | |
: let _ = self.do_send(None, false); | |
: } | |
: } | |
:} | |
: | |
:/* | |
: * | |
: * ===== impl Receiver ===== | |
: * | |
: */ | |
: | |
:impl<T> Receiver<T> { | |
: /// Closes the receiving half | |
: /// | |
: /// This prevents any further messages from being sent on the channel while | |
: /// still enabling the receiver to drain messages that are buffered. | |
: pub fn close(&mut self) { | |
: let mut curr = self.inner.state.load(SeqCst); | |
: | |
: loop { | |
: let mut state = decode_state(curr); | |
: | |
: if !state.is_open { | |
: break | |
: } | |
: | |
: state.is_open = false; | |
: | |
: let next = encode_state(&state); | |
: match self.inner.state.compare_exchange(curr, next, SeqCst, SeqCst) { | |
: Ok(_) => break, | |
: Err(actual) => curr = actual, | |
: } | |
: } | |
: | |
: // Wake up any threads waiting as they'll see that we've closed the | |
: // channel and will continue on their merry way. | |
: loop { | |
: match unsafe { self.inner.parked_queue.pop() } { | |
2 2.1e-05 : PopResult::Data(task) => { | |
: let task = task.lock().unwrap().take(); | |
: if let Some(task) = task { | |
: task.unpark(); | |
: } | |
: } | |
: PopResult::Empty => break, | |
: PopResult::Inconsistent => thread::yield_now(), | |
: } | |
5 5.2e-05 : } | |
: } | |
: | |
4013 0.0421 : fn next_message(&mut self) -> Async<Option<T>> { /* _$LT$futures..sync..mpsc..Receiver$LT$T$GT$$GT$::next_message::h682d62f571f59828 39 4.1e-04, _$LT$futures..sync..mpsc..Receiver$LT$T$GT$$GT$::next_message::h4373a4a667d7f0a1 16706 0.1754, _$LT$futures..sync..mpsc..Receiver$LT$T$GT$$GT$::next_message::hee7fcecd85272425 143 0.0015, total: 16888 0.1773 */ | |
: // Pop off a message | |
: loop { | |
: match unsafe { self.inner.message_queue.pop() } { | |
357 0.0037 : PopResult::Data(msg) => { | |
562 0.0059 : return Async::Ready(msg); | |
: } | |
: PopResult::Empty => { | |
: // The queue is empty, return NotReady | |
153 0.0016 : return Async::NotReady; | |
: } | |
: PopResult::Inconsistent => { | |
: // Inconsistent means that there will be a message to pop | |
: // in a short time. This branch can only be reached if | |
: // values are being produced from another thread, so there | |
: // are a few ways that we can deal with this: | |
: // | |
: // 1) Spin | |
: // 2) thread::yield_now() | |
: // 3) task::park().unwrap() & return NotReady | |
: // | |
: // For now, thread::yield_now() is used, but it would | |
: // probably be better to spin a few times then yield. | |
: thread::yield_now(); | |
: } | |
: } | |
437 0.0046 : } | |
1350 0.0142 : } | |
: | |
: // Unpark a single task handle if there is one pending in the parked queue | |
: fn unpark_one(&mut self) { | |
: loop { | |
130 0.0014 : match unsafe { self.inner.parked_queue.pop() } { | |
371 0.0039 : PopResult::Data(task) => { | |
: // Do this step first so that the lock is dropped when | |
: // `unpark` is called | |
: let task = task.lock().unwrap().take(); | |
: | |
403 0.0042 : if let Some(task) = task { | |
67 7.0e-04 : task.unpark(); | |
113 0.0012 : } | |
: | |
: return; | |
: } | |
: PopResult::Empty => { | |
: // Queue empty, no task to wake up. | |
: return; | |
: } | |
: PopResult::Inconsistent => { | |
: // Same as above | |
: thread::yield_now(); | |
: } | |
: } | |
226 0.0024 : } | |
: } | |
: | |
: // Try to park the receiver task | |
: fn try_park(&self) -> TryPark { | |
: let curr = self.inner.state.load(SeqCst); | |
375 0.0039 : let state = decode_state(curr); | |
: | |
: // If the channel is closed, then there is no need to park. | |
760 0.0080 : if !state.is_open && state.num_messages == 0 { | |
: return TryPark::Closed; | |
: } | |
: | |
: // First, track the task in the `recv_task` slot | |
11 1.2e-04 : let mut recv_task = self.inner.recv_task.lock().unwrap(); | |
: | |
502 0.0053 : if recv_task.unparked { | |
: // Consume the `unpark` signal without actually parking | |
37 3.9e-04 : recv_task.unparked = false; | |
: return TryPark::NotEmpty; | |
: } | |
: | |
3344 0.0351 : recv_task.task = Some(task::park()); | |
: TryPark::Parked | |
: } | |
: | |
: fn dec_num_messages(&self) { | |
: let mut curr = self.inner.state.load(SeqCst); | |
: | |
: loop { | |
107 0.0011 : let mut state = decode_state(curr); | |
: | |
42 4.4e-04 : state.num_messages -= 1; | |
: | |
404 0.0042 : let next = encode_state(&state); | |
: match self.inner.state.compare_exchange(curr, next, SeqCst, SeqCst) { | |
: Ok(_) => break, | |
: Err(actual) => curr = actual, | |
: } | |
: } | |
: } | |
:} | |
: | |
:impl<T> Stream for Receiver<T> { | |
: type Item = T; | |
: type Error = (); | |
: | |
: fn poll(&mut self) -> Poll<Option<T>, ()> { | |
: loop { | |
: // Try to read a message off of the message queue. | |
540 0.0057 : let msg = match self.next_message() { | |
2021 0.0212 : Async::Ready(msg) => msg, | |
: Async::NotReady => { | |
: // There are no messages to read, in this case, attempt to | |
: // park. The act of parking will verify that the channel is | |
: // still empty after the park operation has completed. | |
251 0.0026 : match self.try_park() { | |
: TryPark::Parked => { | |
: // The task was parked, and the channel is still | |
: // empty, return NotReady. | |
: return Ok(Async::NotReady); | |
: } | |
: TryPark::Closed => { | |
: // The channel is closed, there will be no further | |
: // messages. | |
: return Ok(Async::Ready(None)); | |
: } | |
: TryPark::NotEmpty => { | |
: // A message has been sent while attempting to | |
: // park. Loop again, the next iteration is | |
: // guaranteed to get the message. | |
: continue; | |
: } | |
: } | |
: } | |
477 0.0050 : }; | |
: | |
: // If there are any parked task handles in the parked queue, pop | |
: // one and unpark it. | |
11 1.2e-04 : self.unpark_one(); | |
: | |
: // Decrement number of messages | |
135 0.0014 : self.dec_num_messages(); | |
: | |
: // Return the message | |
434 0.0046 : return Ok(Async::Ready(msg)); | |
: } | |
: } | |
:} | |
: | |
:impl<T> Drop for Receiver<T> { | |
: fn drop(&mut self) { | |
: // Drain the channel of all pending messages | |
6 6.3e-05 : self.close(); | |
2 2.1e-05 : while self.next_message().is_ready() { | |
: // ... | |
: } | |
: } | |
:} | |
: | |
:impl<T> UnboundedReceiver<T> { | |
: /// Closes the receiving half | |
: /// | |
: /// This prevents any further messages from being sent on the channel while | |
: /// still enabling the receiver to drain messages that are buffered. | |
: pub fn close(&mut self) { | |
: self.0.close(); | |
: } | |
:} | |
: | |
:impl<T> Stream for UnboundedReceiver<T> { | |
: type Item = T; | |
: type Error = (); | |
: | |
: fn poll(&mut self) -> Poll<Option<T>, ()> { | |
: self.0.poll() | |
: } | |
:} | |
: | |
:/* | |
: * | |
: * ===== impl Inner ===== | |
: * | |
: */ | |
: | |
:impl<T> Inner<T> { | |
: // The return value is such that the total number of messages that can be | |
: // enqueued into the channel will never exceed MAX_CAPACITY | |
: fn max_senders(&self) -> usize { | |
: match self.buffer { | |
: Some(buffer) => MAX_CAPACITY - buffer, | |
: None => MAX_BUFFER, | |
: } | |
: } | |
:} | |
: | |
:unsafe impl<T: Send> Send for Inner<T> {} | |
:unsafe impl<T: Send> Sync for Inner<T> {} | |
: | |
:/* | |
: * | |
: * ===== Helpers ===== | |
: * | |
: */ | |
: | |
1058 0.0111 :fn decode_state(num: usize) -> State { /* futures::sync::mpsc::decode_state::hb45c0ec71e733d6c total: 2677 0.0281 */ | |
672 0.0071 : State { | |
: is_open: num & OPEN_MASK == OPEN_MASK, | |
368 0.0039 : num_messages: num & MAX_CAPACITY, | |
: } | |
579 0.0061 :} | |
: | |
855 0.0090 :fn encode_state(state: &State) -> usize { /* futures::sync::mpsc::encode_state::hb758fd47383aadf0 total: 1748 0.0184 */ | |
147 0.0015 : let mut num = state.num_messages; | |
: | |
230 0.0024 : if state.is_open { | |
287 0.0030 : num |= OPEN_MASK; | |
: } | |
: | |
: num | |
229 0.0024 :} | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/string/../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S" | |
* | |
* 41699 0.4378 | |
*/ | |
/* __memcpy_sse2_unaligned total: 41699 0.4378 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/nptl/../nptl/pthread_mutex_lock.c" | |
* | |
* 39526 0.4150 | |
*/ | |
/* pthread_mutex_lock total: 39526 0.4150 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.6.4/src/poll.rs" | |
* | |
* 32958 0.3461 | |
*/ | |
:use {sys, Evented, Token}; | |
:use event::{self, Ready, Event, PollOpt}; | |
:use std::{fmt, io, mem, ptr, usize}; | |
:use std::cell::{UnsafeCell, Cell}; | |
:use std::isize; | |
:use std::marker; | |
:use std::sync::Arc; | |
:use std::sync::atomic::{AtomicUsize, AtomicPtr, Ordering}; | |
:use std::time::Duration; | |
: | |
:const MAX_REFCOUNT: usize = (isize::MAX) as usize; | |
: | |
:/// Polls for readiness events on all registered values. | |
:/// | |
:/// The `Poll` type acts as an interface allowing a program to wait on a set of | |
:/// IO handles until one or more become "ready" to be operated on. An IO handle | |
:/// is considered ready to operate on when the given operation can complete | |
:/// without blocking. | |
:/// | |
:/// To use `Poll`, an IO handle must first be registered with the `Poll` | |
:/// instance using the `register()` handle. An `Ready` representing the | |
:/// program's interest in the socket is specified as well as an arbitrary | |
:/// `Token` which is used to identify the IO handle in the future. | |
:/// | |
:/// ## Edge-triggered and level-triggered | |
:/// | |
:/// An IO handle registration may request edge-triggered notifications or | |
:/// level-triggered notifications. This is done by specifying the `PollOpt` | |
:/// argument to `register()` and `reregister()`. | |
:/// | |
:/// ## Portability | |
:/// | |
:/// Cross platform portability is provided for Mio's TCP & UDP implementations. | |
:/// | |
:/// ## Examples | |
:/// | |
:/// ```no_run | |
:/// use mio::*; | |
:/// use mio::tcp::*; | |
:/// | |
:/// // Construct a new `Poll` handle as well as the `Events` we'll store into | |
:/// let poll = Poll::new().unwrap(); | |
:/// let mut events = Events::with_capacity(1024); | |
:/// | |
:/// // Connect the stream | |
:/// let stream = TcpStream::connect(&"173.194.33.80:80".parse().unwrap()).unwrap(); | |
:/// | |
:/// // Register the stream with `Poll` | |
:/// poll.register(&stream, Token(0), Ready::all(), PollOpt::edge()).unwrap(); | |
:/// | |
:/// // Wait for the socket to become ready | |
:/// poll.poll(&mut events, None).unwrap(); | |
:/// ``` | |
:pub struct Poll { | |
: // This type is `Send`, but not `Sync`, so ensure it's exposed as such. | |
: _marker: marker::PhantomData<Cell<()>>, | |
: | |
: // Platform specific IO selector | |
: selector: sys::Selector, | |
: | |
: // Custom readiness queue | |
: readiness_queue: ReadinessQueue, | |
:} | |
: | |
:/// Handle to a Poll registration. Used for registering custom types for event | |
:/// notifications. | |
:pub struct Registration { | |
: inner: RegistrationInner, | |
:} | |
: | |
:/// Used to update readiness for an associated `Registration`. `SetReadiness` | |
:/// is `Sync` which allows it to be updated across threads. | |
:#[derive(Clone)] | |
:pub struct SetReadiness { | |
: inner: RegistrationInner, | |
:} | |
: | |
:struct RegistrationInner { | |
: // ARC pointer to the Poll's readiness queue | |
: queue: ReadinessQueue, | |
: | |
: // Unsafe pointer to the registration's node. The node is owned by the | |
: // registration queue. | |
: node: ReadyRef, | |
:} | |
: | |
:#[derive(Clone)] | |
:struct ReadinessQueue { | |
: inner: Arc<UnsafeCell<ReadinessQueueInner>>, | |
:} | |
: | |
:struct ReadinessQueueInner { | |
: // Used to wake up `Poll` when readiness is set in another thread. | |
: awakener: sys::Awakener, | |
: | |
: // All readiness nodes are owned by the `Poll` instance and live either in | |
: // this linked list or in a `readiness_wheel` linked list. | |
: head_all_nodes: Option<Box<ReadinessNode>>, | |
: | |
: // linked list of nodes that are pending some processing | |
: head_readiness: AtomicPtr<ReadinessNode>, | |
: | |
: // A fake readiness node used to indicate that `Poll::poll` will block. | |
: sleep_token: Box<ReadinessNode>, | |
:} | |
: | |
:struct ReadyList { | |
: head: ReadyRef, | |
:} | |
: | |
:struct ReadyRef { | |
: ptr: *mut ReadinessNode, | |
:} | |
: | |
:struct ReadinessNode { | |
: // ===== Fields only accessed by Poll ===== | |
: // | |
: // Next node in ownership tracking queue | |
: next_all_nodes: Option<Box<ReadinessNode>>, | |
: | |
: // Previous node in the owned list | |
: prev_all_nodes: ReadyRef, | |
: | |
: // Data set in register / reregister functions and read in `Poll`. This | |
: // field should only be accessed from the thread that owns the `Poll` | |
: // instance. | |
: registration_data: UnsafeCell<RegistrationData>, | |
: | |
: // ===== Fields accessed by any thread ==== | |
: // | |
: // Used when the node is queued in the readiness linked list. Accessing | |
: // this field requires winning the "queue" lock | |
: next_readiness: ReadyRef, | |
: | |
: // The set of events to include in the notification on next poll | |
: events: AtomicUsize, | |
: | |
: // Tracks if the node is queued for readiness using the MSB, the | |
: // rest of the usize is the readiness delay. | |
: queued: AtomicUsize, | |
: | |
: // Tracks the number of `ReadyRef` pointers | |
: ref_count: AtomicUsize, | |
:} | |
: | |
:struct RegistrationData { | |
: // The Token used to register the `Evented` with`Poll` | |
: token: Token, | |
: | |
: // The registration interest | |
: interest: Ready, | |
: | |
: // Poll opts | |
: opts: PollOpt, | |
:} | |
: | |
:const NODE_QUEUED_FLAG: usize = 1; | |
: | |
:const AWAKEN: Token = Token(usize::MAX); | |
: | |
:/* | |
: * | |
: * ===== Poll ===== | |
: * | |
: */ | |
: | |
:impl Poll { | |
: /// Return a new `Poll` handle using a default configuration. | |
: pub fn new() -> io::Result<Poll> { | |
: let poll = Poll { | |
: selector: try!(sys::Selector::new()), | |
: readiness_queue: try!(ReadinessQueue::new()), | |
: _marker: marker::PhantomData, | |
: }; | |
: | |
: // Register the notification wakeup FD with the IO poller | |
: try!(poll.readiness_queue.inner().awakener.register(&poll, AWAKEN, Ready::readable(), PollOpt::edge())); | |
: | |
: Ok(poll) | |
: } | |
: | |
: /// Register an `Evented` handle with the `Poll` instance. | |
: pub fn register<E: ?Sized>(&self, io: &E, token: Token, interest: Ready, opts: PollOpt) -> io::Result<()> | |
: where E: Evented | |
: { | |
: try!(validate_args(token, interest)); | |
: | |
: /* | |
: * Undefined behavior: | |
: * - Reusing a token with a different `Evented` without deregistering | |
: * (or closing) the original `Evented`. | |
: */ | |
: trace!("registering with poller"); | |
: | |
: // Register interests for this socket | |
: try!(io.register(self, token, interest, opts)); | |
: | |
: Ok(()) | |
: } | |
: | |
: /// Re-register an `Evented` handle with the `Poll` instance. | |
: pub fn reregister<E: ?Sized>(&self, io: &E, token: Token, interest: Ready, opts: PollOpt) -> io::Result<()> | |
: where E: Evented | |
: { | |
: try!(validate_args(token, interest)); | |
: | |
: trace!("registering with poller"); | |
: | |
: // Register interests for this socket | |
: try!(io.reregister(self, token, interest, opts)); | |
: | |
: Ok(()) | |
: } | |
: | |
: /// Deregister an `Evented` handle with the `Poll` instance. | |
: pub fn deregister<E: ?Sized>(&self, io: &E) -> io::Result<()> | |
: where E: Evented | |
: { | |
: trace!("deregistering IO with poller"); | |
: | |
: // Deregister interests for this socket | |
: try!(io.deregister(self)); | |
: | |
: Ok(()) | |
: } | |
: | |
: /// Block the current thread and wait until any `Evented` values registered | |
: /// with the `Poll` instance are ready or the given timeout has elapsed. | |
1728 0.0181 : pub fn poll(&self, /* mio::poll::Poll::poll::heeeced35662b7c8d total: 22591 0.2372 */ | |
: events: &mut Events, | |
: timeout: Option<Duration>) -> io::Result<usize> { | |
1408 0.0148 : let timeout = if !self.readiness_queue.is_empty() { | |
: trace!("custom readiness queue has pending events"); | |
: // Never block if the readiness queue has pending events | |
: Some(Duration::from_millis(0)) | |
: } else if !self.readiness_queue.prepare_for_sleep() { | |
: Some(Duration::from_millis(0)) | |
: } else { | |
: timeout | |
: }; | |
: | |
: // First get selector events | |
995 0.0104 : let awoken = try!(self.selector.select(&mut events.inner, AWAKEN, | |
: timeout)); | |
: | |
: if awoken { | |
1 1.0e-05 : self.readiness_queue.inner().awakener.cleanup(); | |
: } | |
: | |
: // Poll custom event queue | |
29 3.0e-04 : self.readiness_queue.poll(&mut events.inner); | |
: | |
: // Return number of polled events | |
364 0.0038 : Ok(events.len()) | |
602 0.0063 : } | |
:} | |
: | |
:fn validate_args(token: Token, interest: Ready) -> io::Result<()> { | |
: if token == AWAKEN { | |
: return Err(io::Error::new(io::ErrorKind::Other, "invalid token")); | |
: } | |
: | |
: if !interest.is_readable() && !interest.is_writable() { | |
: return Err(io::Error::new(io::ErrorKind::Other, "interest must include readable or writable")); | |
: } | |
: | |
: Ok(()) | |
:} | |
: | |
:impl fmt::Debug for Poll { | |
: fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
: write!(fmt, "Poll") | |
: } | |
:} | |
: | |
:/// A buffer for I/O events to get placed into, passed to `Poll::poll`. | |
:/// | |
:/// This structure is normally re-used on each turn of the event loop and will | |
:/// contain any I/O events that happen during a `poll`. After a call to `poll` | |
:/// returns the various accessor methods on this structure can be used to | |
:/// iterate over the underlying events that ocurred. | |
:pub struct Events { | |
: inner: sys::Events, | |
:} | |
: | |
:/// Iterate an Events structure | |
:pub struct EventsIter<'a> { | |
: inner: &'a Events, | |
: pos: usize, | |
:} | |
: | |
:impl Events { | |
: /// Create a net blank set of events capable of holding up to `capacity` | |
: /// events. | |
: /// | |
: /// This parameter typically is an indicator on how many events can be | |
: /// returned each turn of the event loop, but it is not necessarily a hard | |
: /// limit across platforms. | |
: pub fn with_capacity(capacity: usize) -> Events { | |
: Events { | |
: inner: sys::Events::with_capacity(capacity), | |
: } | |
: } | |
: | |
: /// Returns the `idx`-th event. | |
: /// | |
: /// Returns `None` if `idx` is greater than the length of this event buffer. | |
2276 0.0239 : pub fn get(&self, idx: usize) -> Option<Event> { /* mio::poll::Events::get::hbd4b221db300c772 total: 5149 0.0541 */ | |
: self.inner.get(idx) | |
195 0.0020 : } | |
: | |
: /// Returns how many events this buffer contains. | |
1393 0.0146 : pub fn len(&self) -> usize { /* mio::poll::Events::len::h7a20ac641410b846 total: 1618 0.0170 */ | |
623 0.0065 : self.inner.len() | |
199 0.0021 : } | |
: | |
: /// Returns whether this buffer contains 0 events. | |
: pub fn is_empty(&self) -> bool { | |
: self.inner.is_empty() | |
: } | |
: | |
: pub fn iter(&self) -> EventsIter { | |
: EventsIter { | |
: inner: self, | |
: pos: 0 | |
: } | |
: } | |
:} | |
: | |
:impl<'a> IntoIterator for &'a Events { | |
: type Item = Event; | |
: type IntoIter = EventsIter<'a>; | |
: | |
: fn into_iter(self) -> Self::IntoIter { | |
: self.iter() | |
: } | |
:} | |
: | |
:impl<'a> Iterator for EventsIter<'a> { | |
: type Item = Event; | |
: | |
: fn next(&mut self) -> Option<Event> { | |
: let ret = self.inner.get(self.pos); | |
: self.pos += 1; | |
: ret | |
: } | |
:} | |
: | |
:// ===== Accessors for internal usage ===== | |
: | |
:pub fn selector(poll: &Poll) -> &sys::Selector { | |
: &poll.selector | |
:} | |
: | |
:/* | |
: * | |
: * ===== Registration ===== | |
: * | |
: */ | |
: | |
:impl Registration { | |
: /// Create a new `Registration` associated with the given `Poll` instance. | |
: /// The returned `Registration` will be associated with this `Poll` for its | |
: /// entire lifetime. | |
: pub fn new(poll: &Poll, token: Token, interest: Ready, opts: PollOpt) -> (Registration, SetReadiness) { | |
: let inner = RegistrationInner::new(poll, token, interest, opts); | |
: let registration = Registration { inner: inner.clone() }; | |
: let set_readiness = SetReadiness { inner: inner.clone() }; | |
: | |
: (registration, set_readiness) | |
: } | |
: | |
: pub fn update(&self, poll: &Poll, token: Token, interest: Ready, opts: PollOpt) -> io::Result<()> { | |
: self.inner.update(poll, token, interest, opts) | |
: } | |
: | |
: pub fn deregister(&self, poll: &Poll) -> io::Result<()> { | |
: self.inner.update(poll, Token(0), Ready::none(), PollOpt::empty()) | |
: } | |
:} | |
: | |
:impl Drop for Registration { | |
: fn drop(&mut self) { | |
: let inner = &self.inner; | |
: inner.registration_data_mut(&inner.queue).unwrap().disable(); | |
: } | |
:} | |
: | |
:impl fmt::Debug for Registration { | |
: fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
: fmt.debug_struct("Registration") | |
: .finish() | |
: } | |
:} | |
: | |
:unsafe impl Send for Registration { } | |
: | |
:impl SetReadiness { | |
: pub fn readiness(&self) -> Ready { | |
: self.inner.readiness() | |
: } | |
: | |
4496 0.0472 : pub fn set_readiness(&self, ready: Ready) -> io::Result<()> { /* mio::poll::SetReadiness::set_readiness::hc804a79770e69cbe total: 5484 0.0576 */ | |
60 6.3e-04 : self.inner.set_readiness(ready) | |
928 0.0097 : } | |
:} | |
: | |
:unsafe impl Send for SetReadiness { } | |
:unsafe impl Sync for SetReadiness { } | |
: | |
:impl RegistrationInner { | |
: fn new(poll: &Poll, token: Token, interest: Ready, opts: PollOpt) -> RegistrationInner { | |
: let queue = poll.readiness_queue.clone(); | |
: let node = queue.new_readiness_node(token, interest, opts, 1); | |
: | |
: RegistrationInner { | |
: node: node, | |
: queue: queue, | |
: } | |
: } | |
: | |
: fn update(&self, poll: &Poll, token: Token, interest: Ready, opts: PollOpt) -> io::Result<()> { | |
: // Update the registration data | |
: try!(self.registration_data_mut(&poll.readiness_queue)).update(token, interest, opts); | |
: | |
: // If the node is currently ready, re-queue? | |
: if !event::is_empty(self.readiness()) { | |
: // The releaxed ordering of `self.readiness()` is sufficient here. | |
: // All mutations to readiness will immediately attempt to queue the | |
: // node for processing. This means that this call to | |
: // `queue_for_processing` is only intended to handle cases where | |
: // the node was dequeued in `poll` and then has the interest | |
: // changed, which means that the "newest" readiness value is | |
: // already known by the current thread. | |
: let needs_wakeup = self.queue_for_processing(); | |
: debug_assert!(!needs_wakeup, "something funky is going on"); | |
: } | |
: | |
: Ok(()) | |
: } | |
: | |
: fn readiness(&self) -> Ready { | |
: // A relaxed ordering is sufficient here as a call to `readiness` is | |
: // only meant as a hint to what the current value is. It should not be | |
: // used for any synchronization. | |
: event::from_usize(self.node().events.load(Ordering::Relaxed)) | |
: } | |
: | |
6188 0.0650 : fn set_readiness(&self, ready: Ready) -> io::Result<()> { /* mio::poll::RegistrationInner::set_readiness::h57e48fa2dc14a264 total: 26704 0.2804 */ | |
: // First store in the new readiness using relaxed as this operation is | |
: // permitted to be visible ad-hoc. The `queue_for_processing` function | |
: // will set a `Release` barrier ensuring eventual consistency. | |
: self.node().events.store(event::as_usize(ready), Ordering::Relaxed); | |
: | |
: trace!("set_readiness event {:?} {:?}", ready, self.node().token()); | |
: | |
: // Setting readiness to none doesn't require any processing by the poll | |
: // instance, so there is no need to enqueue the node. No barrier is | |
: // needed in this case since it doesn't really matter when the value | |
: // becomes visible to other threads. | |
689 0.0072 : if event::is_empty(ready) { | |
267 0.0028 : return Ok(()); | |
: } | |
: | |
: if self.queue_for_processing() { | |
: try!(self.queue.wakeup()); | |
: } | |
: | |
: Ok(()) | |
1418 0.0149 : } | |
: | |
: /// Returns true if `Poll` needs to be woken up | |
: fn queue_for_processing(&self) -> bool { | |
: // `Release` ensures that the `events` mutation is visible if this | |
: // mutation is visible. | |
: // | |
: // `Acquire` ensures that a change to `head_readiness` made in the | |
: // poll thread is visible if `queued` has been reset to zero. | |
: let prev = self.node().queued.compare_and_swap(0, NODE_QUEUED_FLAG, Ordering::AcqRel); | |
: | |
: // If the queued flag was not initially set, then the current thread | |
: // is assigned the responsibility of enqueuing the node for processing. | |
: if prev == 0 { | |
: self.queue.prepend_readiness_node(self.node.clone()) | |
: } else { | |
: false | |
: } | |
: } | |
: | |
: fn node(&self) -> &ReadinessNode { | |
: self.node.as_ref().unwrap() | |
: } | |
: | |
: fn registration_data_mut(&self, readiness_queue: &ReadinessQueue) -> io::Result<&mut RegistrationData> { | |
: // `&Poll` is passed in here in order to ensure that this function is | |
: // only called from the thread that owns the `Poll` value. This is | |
: // required because the function will mutate variables that are read | |
: // from a call to `Poll::poll`. | |
: | |
: if !self.queue.identical(readiness_queue) { | |
: return Err(io::Error::new(io::ErrorKind::Other, "registration registered with another instance of Poll")); | |
: } | |
: | |
: Ok(self.node().registration_data_mut()) | |
: } | |
:} | |
: | |
:impl Clone for RegistrationInner { | |
: fn clone(&self) -> RegistrationInner { | |
: // Using a relaxed ordering is alright here, as knowledge of the | |
: // original reference prevents other threads from erroneously deleting | |
: // the object. | |
: // | |
: // As explained in the [Boost documentation][1], Increasing the | |
: // reference counter can always be done with memory_order_relaxed: New | |
: // references to an object can only be formed from an existing | |
: // reference, and passing an existing reference from one thread to | |
: // another must already provide any required synchronization. | |
: // | |
: // [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html) | |
: let old_size = self.node().ref_count.fetch_add(1, Ordering::Relaxed); | |
: | |
: // However we need to guard against massive refcounts in case someone | |
: // is `mem::forget`ing Arcs. If we don't do this the count can overflow | |
: // and users will use-after free. We racily saturate to `isize::MAX` on | |
: // the assumption that there aren't ~2 billion threads incrementing | |
: // the reference count at once. This branch will never be taken in | |
: // any realistic program. | |
: // | |
: // We abort because such a program is incredibly degenerate, and we | |
: // don't care to support it. | |
: if old_size & !MAX_REFCOUNT != 0 { | |
: panic!("too many outstanding refs"); | |
: } | |
: | |
: RegistrationInner { | |
: queue: self.queue.clone(), | |
: node: self.node.clone(), | |
: } | |
: } | |
:} | |
: | |
:impl Drop for RegistrationInner { | |
: fn drop(&mut self) { | |
: // Because `fetch_sub` is already atomic, we do not need to synchronize | |
: // with other threads unless we are going to delete the object. This | |
: // same logic applies to the below `fetch_sub` to the `weak` count. | |
: let old_size = self.node().ref_count.fetch_sub(1, Ordering::Release); | |
: | |
: if old_size != 1 { | |
: return; | |
: } | |
: | |
: // Signal to the queue that the node is not referenced anymore and can | |
: // be released / reused | |
: let _ = self.set_readiness(event::drop()); | |
: } | |
:} | |
: | |
:/* | |
: * | |
: * ===== ReadinessQueue ===== | |
: * | |
: */ | |
: | |
:impl ReadinessQueue { | |
: fn new() -> io::Result<ReadinessQueue> { | |
: let sleep_token = Box::new(ReadinessNode::new(Token(0), Ready::none(), PollOpt::empty(), 0)); | |
: | |
: Ok(ReadinessQueue { | |
: inner: Arc::new(UnsafeCell::new(ReadinessQueueInner { | |
: awakener: try!(sys::Awakener::new()), | |
: head_all_nodes: None, | |
: head_readiness: AtomicPtr::new(ptr::null_mut()), | |
: // Arguments here don't matter, the node is only used for the | |
: // pointer value. | |
: sleep_token: sleep_token, | |
: })) | |
: }) | |
: } | |
: | |
: fn poll(&self, dst: &mut sys::Events) { | |
183 0.0019 : let ready = self.take_ready(); | |
: | |
: // TODO: Cap number of nodes processed | |
: for node in ready { | |
: let mut events; | |
: let opts; | |
: | |
: { | |
: let node_ref = node.as_ref().unwrap(); | |
: opts = node_ref.poll_opts(); | |
: | |
: // Atomically read queued. Use Acquire ordering to set a | |
: // barrier before reading events, which will be read using | |
: // `Relaxed` ordering. Reading events w/ `Relaxed` is OK thanks to | |
: // the acquire / release hand off on `queued`. | |
: let mut queued = node_ref.queued.load(Ordering::Acquire); | |
65 6.8e-04 : events = node_ref.poll_events(); | |
: | |
: // Enter a loop attempting to unset the "queued" bit or requeuing | |
: // the node. | |
: loop { | |
: // In the following conditions, the registration is removed from | |
: // the readiness queue: | |
: // | |
: // - The registration is edge triggered. | |
: // - The event set contains no events | |
: // - There is a requested delay that has not already expired. | |
: // | |
: // If the drop flag is set though, the node is never queued | |
: // again. | |
: if event::is_drop(events) { | |
: // dropped nodes are always processed immediately. There is | |
: // also no need to unset the queued bit as the node should | |
: // not change anymore. | |
: break; | |
293 0.0031 : } else if opts.is_edge() || event::is_empty(events) { | |
: // An acquire barrier is set in order to re-read the | |
: // `events field. `Release` is not needed as we have not | |
: // mutated any field that we need to expose to the producer | |
: // thread. | |
: let next = node_ref.queued.compare_and_swap(queued, 0, Ordering::Acquire); | |
: | |
: // Re-read in order to ensure we have the latest value | |
: // after having marked the registration has dequeued from | |
: // the readiness queue. Again, `Relaxed` is OK since we set | |
: // the barrier above. | |
: events = node_ref.poll_events(); | |
: | |
: if queued == next { | |
: break; | |
: } | |
: | |
: queued = next; | |
: } else { | |
: // The node needs to stay queued for readiness, so it gets | |
: // pushed back onto the queue. | |
: // | |
: // TODO: It would be better to build up a batch list that | |
: // requires a single CAS. Also, `Relaxed` ordering would be | |
: // OK here as the prepend only needs to be visible by the | |
: // current thread. | |
133 0.0014 : let needs_wakeup = self.prepend_readiness_node(node.clone()); | |
: debug_assert!(!needs_wakeup, "something funky is going on"); | |
: break; | |
: } | |
: } | |
: } | |
: | |
: // Process the node. | |
1 1.0e-05 : if event::is_drop(events) { | |
: // Release the node | |
: let _ = self.unlink_node(node); | |
: } else if !events.is_none() { | |
: let node_ref = node.as_ref().unwrap(); | |
: | |
: // TODO: Don't push the event if the capacity of `dst` has | |
: // been reached | |
: trace!("returning readiness event {:?} {:?}", events, | |
: node_ref.token()); | |
: dst.push_event(Event::new(events, node_ref.token())); | |
: | |
: // If one-shot, disarm the node | |
135 0.0014 : if opts.is_oneshot() { | |
: node_ref.registration_data_mut().disable(); | |
: } | |
: } | |
: } | |
: } | |
: | |
: fn wakeup(&self) -> io::Result<()> { | |
: self.inner().awakener.wakeup() | |
: } | |
: | |
: // Attempts to state to sleeping. This involves changing `head_readiness` | |
: // to `sleep_token`. Returns true if `poll` can sleep. | |
: fn prepare_for_sleep(&self) -> bool { | |
: // Use relaxed as no memory besides the pointer is being sent across | |
: // threads. Ordering doesn't matter, only the current value of | |
: // `head_readiness`. | |
: ptr::null_mut() == self.inner().head_readiness | |
: .compare_and_swap(ptr::null_mut(), self.sleep_token(), Ordering::Relaxed) | |
: } | |
: | |
: fn take_ready(&self) -> ReadyList { | |
: // Use `Acquire` ordering to ensure being able to read the latest | |
: // values of all other atomic mutations. | |
49 5.1e-04 : let mut head = self.inner().head_readiness.swap(ptr::null_mut(), Ordering::Acquire); | |
: | |
: if head == self.sleep_token() { | |
: head = ptr::null_mut(); | |
: } | |
: | |
: ReadyList { head: ReadyRef::new(head) } | |
: } | |
: | |
: fn new_readiness_node(&self, token: Token, interest: Ready, opts: PollOpt, ref_count: usize) -> ReadyRef { | |
: let mut node = Box::new(ReadinessNode::new(token, interest, opts, ref_count)); | |
: let ret = ReadyRef::new(&mut *node as *mut ReadinessNode); | |
: | |
: node.next_all_nodes = self.inner_mut().head_all_nodes.take(); | |
: | |
: let ptr = &*node as *const ReadinessNode as *mut ReadinessNode; | |
: | |
: if let Some(ref mut next) = node.next_all_nodes { | |
: next.prev_all_nodes = ReadyRef::new(ptr); | |
: } | |
: | |
: self.inner_mut().head_all_nodes = Some(node); | |
: | |
: ret | |
: } | |
: | |
: /// Prepend the given node to the head of the readiness queue. This is done | |
: /// with relaxed ordering. Returns true if `Poll` needs to be woken up. | |
: fn prepend_readiness_node(&self, mut node: ReadyRef) -> bool { | |
985 0.0103 : let mut curr_head = self.inner().head_readiness.load(Ordering::Relaxed); | |
: | |
: loop { | |
276 0.0029 : let node_next = if curr_head == self.sleep_token() { | |
: ptr::null_mut() | |
: } else { | |
: curr_head | |
: }; | |
: | |
: // Update next pointer | |
197 0.0021 : node.as_mut().unwrap().next_readiness = ReadyRef::new(node_next); | |
: | |
: // Update the ref, use release ordering to ensure that mutations to | |
: // previous atomics are visible if the mutation to the head pointer | |
: // is. | |
: let next_head = self.inner().head_readiness.compare_and_swap(curr_head, node.ptr, Ordering::Release); | |
: | |
2455 0.0258 : if curr_head == next_head { | |
: return curr_head == self.sleep_token(); | |
: } | |
: | |
: curr_head = next_head; | |
: } | |
: } | |
: | |
: fn unlink_node(&self, mut node: ReadyRef) -> Box<ReadinessNode> { | |
: node.as_mut().unwrap().unlink(&mut self.inner_mut().head_all_nodes) | |
: } | |
: | |
: fn is_empty(&self) -> bool { | |
18 1.9e-04 : self.inner().head_readiness.load(Ordering::Relaxed).is_null() | |
: } | |
: | |
: fn sleep_token(&self) -> *mut ReadinessNode { | |
7 7.3e-05 : &*self.inner().sleep_token as *const ReadinessNode as *mut ReadinessNode | |
: } | |
: | |
: fn identical(&self, other: &ReadinessQueue) -> bool { | |
: self.inner.get() == other.inner.get() | |
: } | |
: | |
: fn inner(&self) -> &ReadinessQueueInner { | |
: unsafe { mem::transmute(self.inner.get()) } | |
: } | |
: | |
: fn inner_mut(&self) -> &mut ReadinessQueueInner { | |
: unsafe { mem::transmute(self.inner.get()) } | |
: } | |
:} | |
: | |
:unsafe impl Send for ReadinessQueue { } | |
: | |
:impl ReadinessNode { | |
: fn new(token: Token, interest: Ready, opts: PollOpt, ref_count: usize) -> ReadinessNode { | |
: ReadinessNode { | |
: next_all_nodes: None, | |
: prev_all_nodes: ReadyRef::none(), | |
: registration_data: UnsafeCell::new(RegistrationData::new(token, interest, opts)), | |
: next_readiness: ReadyRef::none(), | |
: events: AtomicUsize::new(0), | |
: queued: AtomicUsize::new(0), | |
: ref_count: AtomicUsize::new(ref_count), | |
: } | |
: } | |
: | |
: fn poll_events(&self) -> Ready { | |
: (self.interest() | event::drop()) & event::from_usize(self.events.load(Ordering::Relaxed)) | |
: } | |
: | |
: fn token(&self) -> Token { | |
224 0.0024 : unsafe { &*self.registration_data.get() }.token | |
: } | |
: | |
: fn interest(&self) -> Ready { | |
63 6.6e-04 : unsafe { &*self.registration_data.get() }.interest | |
: } | |
: | |
: fn poll_opts(&self) -> PollOpt { | |
110 0.0012 : unsafe { &*self.registration_data.get() }.opts | |
: } | |
: | |
: fn registration_data_mut(&self) -> &mut RegistrationData { | |
: unsafe { &mut *self.registration_data.get() } | |
: } | |
: | |
: fn unlink(&mut self, head: &mut Option<Box<ReadinessNode>>) -> Box<ReadinessNode> { | |
: if let Some(ref mut next) = self.next_all_nodes { | |
: next.prev_all_nodes = self.prev_all_nodes.clone(); | |
: } | |
: | |
: let node; | |
: | |
: match self.prev_all_nodes.take().as_mut() { | |
: Some(prev) => { | |
: node = prev.next_all_nodes.take().unwrap(); | |
: prev.next_all_nodes = self.next_all_nodes.take(); | |
: } | |
: None => { | |
: node = head.take().unwrap(); | |
: *head = self.next_all_nodes.take(); | |
: } | |
: } | |
: | |
: node | |
: } | |
:} | |
: | |
:impl RegistrationData { | |
: fn new(token: Token, interest: Ready, opts: PollOpt) -> RegistrationData { | |
: RegistrationData { | |
: token: token, | |
: interest: interest, | |
: opts: opts, | |
: } | |
: } | |
: | |
: fn update(&mut self, token: Token, interest: Ready, opts: PollOpt) { | |
: self.token = token; | |
: self.interest = interest; | |
: self.opts = opts; | |
: } | |
: | |
: fn disable(&mut self) { | |
: self.interest = Ready::none(); | |
: self.opts = PollOpt::empty(); | |
: } | |
:} | |
: | |
:impl Iterator for ReadyList { | |
: type Item = ReadyRef; | |
: | |
: fn next(&mut self) -> Option<ReadyRef> { | |
: let mut next = self.head.take(); | |
: | |
258 0.0027 : if next.is_some() { | |
: next.as_mut().map(|n| self.head = n.next_readiness.take()); | |
: Some(next) | |
: } else { | |
: None | |
: } | |
: } | |
:} | |
: | |
:impl ReadyRef { | |
: fn new(ptr: *mut ReadinessNode) -> ReadyRef { | |
: ReadyRef { ptr: ptr } | |
584 0.0061 : } | |
: | |
: fn none() -> ReadyRef { | |
: ReadyRef { ptr: ptr::null_mut() } | |
: } | |
: | |
: fn take(&mut self) -> ReadyRef { | |
43 4.5e-04 : let ret = ReadyRef { ptr: self.ptr }; | |
203 0.0021 : self.ptr = ptr::null_mut(); | |
: ret | |
: } | |
: | |
: fn is_some(&self) -> bool { | |
2409 0.0253 : !self.is_none() | |
: } | |
: | |
: fn is_none(&self) -> bool { | |
: self.ptr.is_null() | |
: } | |
: | |
: fn as_ref(&self) -> Option<&ReadinessNode> { | |
407 0.0043 : if self.ptr.is_null() { | |
: return None; | |
: } | |
: | |
: unsafe { Some(&*self.ptr) } | |
: } | |
: | |
: fn as_mut(&mut self) -> Option<&mut ReadinessNode> { | |
: if self.ptr.is_null() { | |
: return None; | |
: } | |
: | |
: unsafe { Some(&mut *self.ptr) } | |
: } | |
:} | |
: | |
:impl Clone for ReadyRef { | |
: fn clone(&self) -> ReadyRef { | |
1 1.0e-05 : ReadyRef::new(self.ptr) | |
: } | |
:} | |
: | |
:impl fmt::Pointer for ReadyRef { | |
: fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
: match self.as_ref() { | |
: Some(r) => fmt::Pointer::fmt(&r, fmt), | |
: None => fmt::Pointer::fmt(&ptr::null::<ReadinessNode>(), fmt), | |
: } | |
: } | |
:} | |
: | |
:#[cfg(test)] | |
:mod test { | |
: use {Ready, Poll, PollOpt, Registration, SetReadiness, Token, Events}; | |
: use std::time::Duration; | |
: | |
: fn ensure_send<T: Send>(_: &T) {} | |
: fn ensure_sync<T: Sync>(_: &T) {} | |
: | |
: #[allow(dead_code)] | |
: fn ensure_type_bounds(r: &Registration, s: &SetReadiness) { | |
: ensure_send(r); | |
: ensure_send(s); | |
: ensure_sync(s); | |
: } | |
: | |
: fn readiness_node_count(poll: &Poll) -> usize { | |
: let mut cur = poll.readiness_queue.inner().head_all_nodes.as_ref(); | |
: let mut cnt = 0; | |
: | |
: while let Some(node) = cur { | |
: cnt += 1; | |
: cur = node.next_all_nodes.as_ref(); | |
: } | |
: | |
: cnt | |
: } | |
: | |
: #[test] | |
: pub fn test_nodes_do_not_leak() { | |
: let mut poll = Poll::new().unwrap(); | |
: let mut events = Events::with_capacity(1024); | |
: let mut registrations = Vec::with_capacity(1_000); | |
: | |
: for _ in 0..3 { | |
: registrations.push(Registration::new(&mut poll, Token(0), Ready::readable(), PollOpt::edge())); | |
: } | |
: | |
: drop(registrations); | |
: | |
: // Poll | |
: let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); | |
: | |
: assert_eq!(0, num); | |
: assert_eq!(0, readiness_node_count(&poll)); | |
: } | |
:} | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/string/../sysdeps/x86_64/multiarch/memcmp-sse4.S" | |
* | |
* 31116 0.3267 | |
*/ | |
/* __memcmp_sse4_1 total: 31116 0.3267 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-proto-0.1.0/src/streaming/pipeline/advanced.rs" | |
* | |
* 30271 0.3178 | |
*/ | |
://! Provides the substrate for implementing pipelined, streaming protocols. | |
://! | |
://! In most cases, it's sufficient to work with `streaming::pipeline::{Client, | |
://! Server}` instead. But for some advanced protocols in which the client and | |
://! servers have more of a peer relationship, it's useful to work directly with | |
://! these implementation details. | |
: | |
:use futures::sync::mpsc; | |
:use futures::{Future, Poll, Async, Stream, Sink, AsyncSink, StartSend}; | |
:use std::io; | |
:use streaming::{Message, Body}; | |
:use super::{Frame, Transport}; | |
:use buffer_one::BufferOne; | |
: | |
:// TODO: | |
:// | |
:// - Wait for service readiness | |
:// - Handle request body stream cancellation | |
: | |
:/// Provides protocol pipelining functionality in a generic way over clients | |
:/// and servers. Used internally by `pipeline::Client` and `pipeline::Server`. | |
:pub struct Pipeline<T> where T: Dispatch { | |
: // True as long as the connection has more request frames to read. | |
: run: bool, | |
: | |
: // Glues the service with the pipeline task | |
: dispatch: BufferOne<DispatchSink<T>>, | |
: | |
: // The `Sender` for the current request body stream | |
: out_body: Option<BodySender<T::BodyOut, T::Error>>, | |
: | |
: // The response body stream | |
: in_body: Option<T::Stream>, | |
: | |
: // True when the transport is fully flushed | |
: is_flushed: bool, | |
:} | |
: | |
:/// Message used to communicate through the multiplex dispatch | |
:pub type PipelineMessage<T, B, E> = Result<Message<T, B>, E>; | |
: | |
:/// Dispatch messages from the transport to the service | |
:pub trait Dispatch { | |
: /// Type of underlying I/O object | |
: type Io; | |
: | |
: /// Message written to transport | |
: type In; | |
: | |
: /// Body written to transport | |
: type BodyIn; | |
: | |
: /// Messages read from the transport | |
: type Out; | |
: | |
: /// Outbound body frame | |
: type BodyOut; | |
: | |
: /// Transport error | |
: type Error: From<io::Error>; | |
: | |
: /// Body stream written to transport | |
: type Stream: Stream<Item = Self::BodyIn, Error = Self::Error>; | |
: | |
: /// Transport type | |
: type Transport: Transport<Item = Frame<Self::Out, Self::BodyOut, Self::Error>, | |
: SinkItem = Frame<Self::In, Self::BodyIn, Self::Error>>; | |
: | |
: /// Mutable reference to the transport | |
: fn transport(&mut self) -> &mut Self::Transport; | |
: | |
: /// Process an out message | |
: fn dispatch(&mut self, message: PipelineMessage<Self::Out, Body<Self::BodyOut, Self::Error>, Self::Error>) -> io::Result<()>; | |
: | |
: /// Poll the next completed message | |
: fn poll(&mut self) -> Poll<Option<PipelineMessage<Self::In, Self::Stream, Self::Error>>, io::Error>; | |
: | |
: /// RPC currently in flight | |
: /// TODO: Get rid of | |
: fn has_in_flight(&self) -> bool; | |
:} | |
: | |
:struct DispatchSink<T> { | |
: inner: T, | |
:} | |
: | |
:type BodySender<B, E> = BufferOne<mpsc::Sender<Result<B, E>>>; | |
: | |
:impl<T> Pipeline<T> where T: Dispatch { | |
: /// Create a new pipeline `Pipeline` dispatcher with the given service and | |
: /// transport | |
: pub fn new(dispatch: T) -> Pipeline<T> { | |
: // Add `Sink` impl for `Dispatch` | |
: let dispatch = DispatchSink { inner: dispatch }; | |
: | |
: // Add a single slot buffer for the sink | |
: let dispatch = BufferOne::new(dispatch); | |
: | |
: Pipeline { | |
: run: true, | |
: dispatch: dispatch, | |
: out_body: None, | |
: in_body: None, | |
: is_flushed: true, | |
: } | |
: } | |
: | |
: /// Returns true if the pipeline server dispatch has nothing left to do | |
: fn is_done(&self) -> bool { | |
1874 0.0197 : !self.run && self.is_flushed && !self.has_in_flight() | |
: } | |
: | |
: fn read_out_frames(&mut self) -> io::Result<()> { | |
2096 0.0220 : while self.run { | |
: // Return true if the pipeliner can process new outbound frames | |
: if !self.check_out_body_stream() { | |
: break; | |
: } | |
: | |
2754 0.0289 : if let Async::Ready(frame) = try!(self.dispatch.get_mut().inner.transport().poll()) { | |
: try!(self.process_out_frame(frame)); | |
: } else { | |
: break; | |
: } | |
: } | |
: | |
: Ok(()) | |
: } | |
: | |
: fn check_out_body_stream(&mut self) -> bool { | |
: let body = match self.out_body { | |
1014 0.0106 : Some(ref mut body) => body, | |
: None => return true, | |
: }; | |
: | |
245 0.0026 : body.poll_ready().is_ready() | |
: } | |
: | |
: fn process_out_frame(&mut self, | |
146 0.0015 : frame: Option<Frame<T::Out, T::BodyOut, T::Error>>) | |
: -> io::Result<()> { | |
: trace!("process_out_frame"); | |
: // At this point, the service & transport are ready to process the | |
: // frame, no matter what it is. | |
: match frame { | |
546 0.0057 : Some(Frame::Message { message, body }) => { | |
: if body { | |
: trace!("read out message with body"); | |
: | |
1 1.0e-05 : let (tx, rx) = Body::pair(); | |
3 3.1e-05 : let message = Message::WithBody(message, rx); | |
: | |
: // Track the out body sender. If `self.out_body` | |
: // currently holds a sender for the previous out body, it | |
: // will get dropped. This terminates the stream. | |
819 0.0086 : self.out_body = Some(BufferOne::new(tx)); | |
: | |
36 3.8e-04 : if let Err(_) = self.dispatch.get_mut().inner.dispatch(Ok(message)) { | |
: // TODO: Should dispatch be infallible | |
: unimplemented!(); | |
: } | |
: } else { | |
: trace!("read out message"); | |
: | |
: let message = Message::WithoutBody(message); | |
: | |
: // There is no streaming body. Set `out_body` to `None` so that | |
: // the previous body stream is dropped. | |
168 0.0018 : self.out_body = None; | |
: | |
107 0.0011 : if let Err(_) = self.dispatch.get_mut().inner.dispatch(Ok(message)) { | |
: // TODO: Should dispatch be infalliable | |
: unimplemented!(); | |
: } | |
: } | |
: } | |
3334 0.0350 : Some(Frame::Body { chunk }) => { | |
: match chunk { | |
947 0.0099 : Some(chunk) => { | |
: trace!("read out body chunk"); | |
: try!(self.process_out_body_chunk(chunk)); | |
: } | |
: None => { | |
: trace!("read out body EOF"); | |
: // Drop the sender. | |
: // TODO: Ensure a sender exists | |
: let _ = self.out_body.take(); | |
: } | |
: } | |
: } | |
: None => { | |
: trace!("read Frame::Done"); | |
: // At this point, we just return. This works | |
: // because tick() will be called again and go | |
: // through the read-cycle again. | |
: self.run = false; | |
: } | |
: Some(Frame::Error { .. }) => { | |
: // At this point, the transport is toast, there | |
: // isn't much else that we can do. Killing the task | |
: // will cause all in-flight requests to abort, but | |
: // they can't be written to the transport anyway... | |
: return Err(io::Error::new(io::ErrorKind::BrokenPipe, "An error occurred.")); | |
: } | |
: } | |
: | |
: Ok(()) | |
2963 0.0311 : } | |
: | |
661 0.0069 : fn process_out_body_chunk(&mut self, chunk: T::BodyOut) -> io::Result<()> { | |
: trace!("process_out_body_chunk"); | |
: let mut reset = false; | |
: match self.out_body { | |
928 0.0097 : Some(ref mut body) => { | |
: debug!("sending a chunk"); | |
: | |
: // Try sending the out body chunk | |
: match body.start_send(Ok(chunk)) { | |
1210 0.0127 : Ok(AsyncSink::Ready) => debug!("immediately done"), | |
: Err(_e) => reset = true, // interest canceled | |
: Ok(AsyncSink::NotReady(_)) => { | |
: // poll_ready() is checked before entering this path | |
: unreachable!(); | |
: } | |
: } | |
3116 0.0327 : } | |
: None => { | |
: debug!("interest canceled"); | |
: // The rx half canceled interest, there is nothing else to do | |
: } | |
: } | |
692 0.0073 : if reset { | |
: self.out_body = None; | |
: } | |
: Ok(()) | |
: } | |
: | |
: fn write_in_frames(&mut self) -> io::Result<()> { | |
: trace!("write_in_frames"); | |
: while self.dispatch.poll_ready().is_ready() { | |
: // Ensure the current in body is fully written | |
: if !try!(self.write_in_body()) { | |
: debug!("write in body not done"); | |
: break; | |
: } | |
: debug!("write in body done"); | |
: | |
: // Write the next in-flight in message | |
: match try!(self.dispatch.get_mut().inner.poll()) { | |
581 0.0061 : Async::Ready(Some(Ok(message))) => { | |
: trace!(" --> got message"); | |
8 8.4e-05 : try!(self.write_in_message(Ok(message))); | |
: } | |
: Async::Ready(Some(Err(error))) => { | |
: trace!(" --> got error"); | |
: try!(self.write_in_message(Err(error))); | |
: } | |
: Async::Ready(None) => { | |
: trace!(" --> got None"); | |
: // The service is done with the connection. | |
: break; | |
: } | |
: // Nothing to dispatch | |
: Async::NotReady => break, | |
: } | |
: } | |
: | |
: Ok(()) | |
: } | |
: | |
14 1.5e-04 : fn write_in_message(&mut self, message: Result<Message<T::In, T::Stream>, T::Error>) -> io::Result<()> { /* _$LT$tokio_proto..streaming..pipeline..advanced..Pipeline$LT$T$GT$$GT$::write_in_message::h3f4a058620c2d244 total: 69 7.2e-04 */ | |
: trace!("write_in_message"); | |
: match message { | |
12 1.3e-04 : Ok(Message::WithoutBody(val)) => { | |
: trace!("got in_flight value without body"); | |
: let msg = Frame::Message { message: val, body: false }; | |
7 7.3e-05 : try!(assert_send(&mut self.dispatch, msg)); | |
: | |
: // TODO: don't panic maybe if this isn't true? | |
: assert!(self.in_body.is_none()); | |
: | |
: // Track the response body | |
5 5.2e-05 : self.in_body = None; | |
: } | |
: Ok(Message::WithBody(val, body)) => { | |
: trace!("got in_flight value with body"); | |
: let msg = Frame::Message { message: val, body: true }; | |
: try!(assert_send(&mut self.dispatch, msg)); | |
: | |
: // TODO: don't panic maybe if this isn't true? | |
: assert!(self.in_body.is_none()); | |
: | |
: // Track the response body | |
: self.in_body = Some(body); | |
: } | |
: Err(e) => { | |
: trace!("got in_flight error"); | |
: let msg = Frame::Error { error: e }; | |
: try!(assert_send(&mut self.dispatch, msg)); | |
: } | |
: } | |
: | |
: Ok(()) | |
14 1.5e-04 : } | |
: | |
: // Returns true if the response body is fully written | |
: fn write_in_body(&mut self) -> io::Result<bool> { | |
: trace!("write_in_body"); | |
: | |
737 0.0077 : if self.in_body.is_some() { | |
: loop { | |
: // Even though this is checked before entering the function, checking should be | |
: // cheap and this is looped | |
: if !self.dispatch.poll_ready().is_ready() { | |
: return Ok(false); | |
: } | |
: | |
: match self.in_body.as_mut().unwrap().poll() { | |
: Ok(Async::Ready(Some(chunk))) => { | |
: try!(assert_send(&mut self.dispatch, | |
: Frame::Body { chunk: Some(chunk) })); | |
: } | |
: Ok(Async::Ready(None)) => { | |
: try!(assert_send(&mut self.dispatch, | |
: Frame::Body { chunk: None })); | |
: break; | |
: } | |
: Err(_) => { | |
: unimplemented!(); | |
: } | |
: Ok(Async::NotReady) => { | |
: debug!("not ready"); | |
: return Ok(false); | |
: } | |
: } | |
: } | |
: } | |
: | |
2059 0.0216 : self.in_body = None; | |
: Ok(true) | |
: } | |
: | |
: fn flush(&mut self) -> io::Result<()> { | |
129 0.0014 : self.is_flushed = try!(self.dispatch.poll_complete()).is_ready(); | |
: | |
445 0.0047 : if let Some(ref mut out_body) = self.out_body { | |
: if out_body.poll_complete().is_ok() { | |
: return Ok(()); | |
: } | |
: } else { | |
: return Ok(()); | |
: } | |
: | |
: // Fall through and unset out_body | |
: self.out_body = None; | |
: Ok(()) | |
: } | |
: | |
: fn has_in_flight(&self) -> bool { | |
: self.dispatch.get_ref().inner.has_in_flight() | |
: } | |
:} | |
: | |
:impl<T> Future for Pipeline<T> where T: Dispatch { | |
: type Item = (); | |
: type Error = io::Error; | |
: | |
: // Tick the pipeline state machine | |
1291 0.0136 : fn poll(&mut self) -> Poll<(), io::Error> { /* _$LT$tokio_proto..streaming..pipeline..advanced..Pipeline$LT$T$GT$$u20$as$u20$futures..future..Future$GT$::poll::hb48155bb23977961 total: 102171 1.0728 */ | |
: trace!("Pipeline::tick"); | |
: | |
: // Always tick the transport first | |
333 0.0035 : self.dispatch.get_mut().inner.transport().tick(); | |
: | |
: // First read off data from the socket | |
6 6.3e-05 : try!(self.read_out_frames()); | |
: | |
: // Handle completed responses | |
: try!(self.write_in_frames()); | |
: | |
: // Try flushing buffered writes | |
: try!(self.flush()); | |
: | |
: // Clean shutdown of the pipeline server can happen when | |
: // | |
: // 1. The server is done running, this is signaled by Transport::read() | |
: // returning Frame::Done. | |
: // | |
: // 2. The transport is done writing all data to the socket, this is | |
: // signaled by Transport::flush() returning Ok(Some(())). | |
: // | |
: // 3. There are no further responses to write to the transport. | |
: // | |
: // It is necessary to perfom these three checks in order to handle the | |
: // case where the client shuts down half the socket. | |
: // | |
: if self.is_done() { | |
: return Ok(().into()) | |
: } | |
: | |
: // Tick again later | |
278 0.0029 : Ok(Async::NotReady) | |
651 0.0068 : } | |
:} | |
: | |
:impl<T: Dispatch> Sink for DispatchSink<T> { | |
: type SinkItem = <T::Transport as Sink>::SinkItem; | |
: type SinkError = io::Error; | |
: | |
13 1.4e-04 : fn start_send(&mut self, item: Self::SinkItem) /* _$LT$tokio_proto..streaming..pipeline..advanced..DispatchSink$LT$T$GT$$u20$as$u20$futures..sink..Sink$GT$::start_send::h57cd3384d12cf22b total: 185 0.0019 */ | |
: -> StartSend<Self::SinkItem, io::Error> | |
: { | |
: self.inner.transport().start_send(item) | |
2 2.1e-05 : } | |
: | |
: fn poll_complete(&mut self) -> Poll<(), io::Error> { | |
: self.inner.transport().poll_complete() | |
: } | |
:} | |
: | |
14 1.5e-04 :fn assert_send<S: Sink>(s: &mut S, item: S::SinkItem) -> Result<(), S::SinkError> { /* tokio_proto::streaming::pipeline::advanced::assert_send::h86dbcb340001c41b total: 57 6.0e-04 */ | |
: match try!(s.start_send(item)) { | |
2 2.1e-05 : AsyncSink::Ready => Ok(()), | |
: AsyncSink::NotReady(_) => { | |
: panic!("sink reported itself as ready after `poll_ready` but was \ | |
: then unable to accept a message") | |
: } | |
: } | |
10 1.0e-04 :} | |
/* | |
* Total samples for file : "LazyValueInfo.cpp" | |
* | |
* 28771 0.3021 | |
*/ | |
<credited to line zero> 28771 0.3021 : | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >, llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::moveFromOldBuckets(llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal>*, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal>*) total: 46 4.8e-04 */ | |
/* llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::grow(unsigned int) total: 77 8.1e-04 */ | |
/* (anonymous namespace)::LazyValueInfoCache::solveBlockValueCast((anonymous namespace)::LVILatticeVal&, llvm::Instruction*, llvm::BasicBlock*) total: 30 3.1e-04 */ | |
/* (anonymous namespace)::LazyValueInfoCache::solveBlockValueBinaryOp((anonymous namespace)::LVILatticeVal&, llvm::Instruction*, llvm::BasicBlock*) total: 30 3.1e-04 */ | |
/* std::_Rb_tree<(anonymous namespace)::LVIValueHandle, std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > >, std::_Select1st<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > >, std::less<(anonymous namespace)::LVIValueHandle>, std::allocator<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > > >::find((anonymous namespace)::LVIValueHandle const&) total: 2137 0.0224 */ | |
/* (anonymous namespace)::LVILatticeVal::LVILatticeVal() total: 7 7.3e-05 */ | |
/* llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::getLargeRep() const total: 62 6.5e-04 */ | |
/* llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::allocateBuckets(unsigned int) [clone .isra.28] total: 7 7.3e-05 */ | |
/* __gnu_cxx::__normal_iterator<llvm::BasicBlock**, std::vector<llvm::BasicBlock*, std::allocator<llvm::BasicBlock*> > > std::__copy_move_a2<false, llvm::TerminatorInst::SuccIterator<llvm::TerminatorInst*, llvm::BasicBlock>, __gnu_cxx::__normal_iterator<llvm::BasicBlock**, std::vector<llvm::BasicBlock*, std::allocator<llvm::BasicBlock*> > > >(llvm::TerminatorInst::SuccIterator<llvm::TerminatorInst*, llvm::BasicBlock>, llvm::TerminatorInst::SuccIterator<llvm::TerminatorInst*, llvm::BasicBlock>, __gnu_cxx::__normal_iterator<llvm::BasicBlock**, std::vector<llvm::BasicBlock*, std::allocator<llvm::BasicBlock*> > >) [clone .isra.409] total: 1 1.0e-05 */ | |
/* llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::getBuckets() const total: 32 3.4e-04 */ | |
/* std::_Deque_base<std::pair<llvm::BasicBlock*, llvm::Value*>, std::allocator<std::pair<llvm::BasicBlock*, llvm::Value*> > >::_M_initialize_map(unsigned long) [clone .constprop.481] total: 44 4.6e-04 */ | |
/* (anonymous namespace)::LVILatticeVal::~LVILatticeVal() total: 57 6.0e-04 */ | |
/* (anonymous namespace)::LVILatticeVal::operator=((anonymous namespace)::LVILatticeVal&&) total: 394 0.0041 */ | |
/* (anonymous namespace)::LVILatticeVal::LVILatticeVal((anonymous namespace)::LVILatticeVal const&) total: 424 0.0045 */ | |
/* (anonymous namespace)::LVILatticeVal::operator=((anonymous namespace)::LVILatticeVal const&) total: 337 0.0035 */ | |
/* hasSingleValue((anonymous namespace)::LVILatticeVal const&) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::LVILatticeVal::markConstantRange(llvm::ConstantRange) total: 36 3.8e-04 */ | |
/* (anonymous namespace)::LVILatticeVal::getRange(llvm::ConstantRange) total: 12 1.3e-04 */ | |
/* intersect((anonymous namespace)::LVILatticeVal, (anonymous namespace)::LVILatticeVal) total: 243 0.0026 */ | |
/* getFromRangeMetadata(llvm::Instruction*) total: 223 0.0023 */ | |
/* (anonymous namespace)::LVILatticeVal::markConstant(llvm::Constant*) total: 19 2.0e-04 */ | |
/* (anonymous namespace)::LVILatticeVal::get(llvm::Constant*) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::LVILatticeVal::markNotConstant(llvm::Constant*) total: 25 2.6e-04 */ | |
/* (anonymous namespace)::LVILatticeVal::getNot(llvm::Constant*) total: 33 3.5e-04 */ | |
/* getPredicateResult(unsigned int, llvm::Constant*, (anonymous namespace)::LVILatticeVal&, llvm::DataLayout const&, llvm::TargetLibraryInfo*) total: 126 0.0013 */ | |
/* (anonymous namespace)::LVILatticeVal::mergeIn((anonymous namespace)::LVILatticeVal const&, llvm::DataLayout const&) total: 256 0.0027 */ | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >, llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::initEmpty() total: 373 0.0039 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::AssertingVH<llvm::BasicBlock>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::BasicBlock> > >, llvm::AssertingVH<llvm::BasicBlock>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::BasicBlock> > >::destroyAll() [clone .part.222] total: 120 0.0013 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::AssertingVH<llvm::BasicBlock>, llvm::SmallPtrSet<llvm::Value*, 4u>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, llvm::SmallPtrSet<llvm::Value*, 4u> > >, llvm::AssertingVH<llvm::BasicBlock>, llvm::SmallPtrSet<llvm::Value*, 4u>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, llvm::SmallPtrSet<llvm::Value*, 4u> > >::destroyAll() [clone .part.224] total: 208 0.0022 */ | |
/* llvm::DenseMapIterator<llvm::AssertingVH<llvm::BasicBlock>, llvm::SmallPtrSet<llvm::Value*, 4u>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, llvm::SmallPtrSet<llvm::Value*, 4u> >, false>::AdvancePastEmptyBuckets() [clone .isra.225] total: 2 2.1e-05 */ | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >, llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::destroyAll() total: 339 0.0036 */ | |
/* std::_Rb_tree<(anonymous namespace)::LVIValueHandle, std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > >, std::_Select1st<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > >, std::less<(anonymous namespace)::LVIValueHandle>, std::allocator<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > > >::_M_erase(std::_Rb_tree_node<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > >*) total: 33 3.5e-04 */ | |
/* (anonymous namespace)::LazyValueInfoCache::~LazyValueInfoCache() total: 41 4.3e-04 */ | |
/* std::pair<(anonymous namespace)::LVIValueHandle, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > >::~pair() total: 36 3.8e-04 */ | |
/* (anonymous namespace)::LazyValueInfoCache::isOverdefined(llvm::Value*, llvm::BasicBlock*) const total: 1161 0.0122 */ | |
/* bool llvm::DenseMapBase<llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >, llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::LookupBucketFor<llvm::AssertingVH<llvm::BasicBlock> >(llvm::AssertingVH<llvm::BasicBlock> const&, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> const*&) const total: 1140 0.0120 */ | |
/* bool llvm::DenseMapBase<llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >, llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::LookupBucketFor<llvm::AssertingVH<llvm::BasicBlock> >(llvm::AssertingVH<llvm::BasicBlock> const&, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal>*&) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::LazyValueInfoCache::hasCachedValueInfo(llvm::Value*, llvm::BasicBlock*) [clone .part.299] total: 542 0.0057 */ | |
/* (anonymous namespace)::LazyValueInfoCache::hasCachedValueInfo(llvm::Value*, llvm::BasicBlock*) total: 86 9.0e-04 */ | |
/* (anonymous namespace)::LazyValueInfoCache::hasBlockValue(llvm::Value*, llvm::BasicBlock*) total: 397 0.0042 */ | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >, llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::InsertIntoBucket(llvm::AssertingVH<llvm::BasicBlock>&&, (anonymous namespace)::LVILatticeVal&&, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal>*) total: 163 0.0017 */ | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >, llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::FindAndConstruct(llvm::AssertingVH<llvm::BasicBlock>&&) total: 120 0.0013 */ | |
/* getValueFromFromCondition(llvm::Value*, llvm::ICmpInst*, (anonymous namespace)::LVILatticeVal&, bool) total: 736 0.0077 */ | |
/* (anonymous namespace)::LazyValueInfoCache::intersectAssumeBlockValueConstantRange(llvm::Value*, (anonymous namespace)::LVILatticeVal&, llvm::Instruction*) [clone .isra.432] total: 2492 0.0262 */ | |
/* (anonymous namespace)::LazyValueInfoCache::getValueAt(llvm::Value*, llvm::Instruction*) total: 258 0.0027 */ | |
/* getEdgeValueLocal(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, (anonymous namespace)::LVILatticeVal&) total: 1219 0.0128 */ | |
/* (anonymous namespace)::LazyValueInfoCache::eraseBlock(llvm::BasicBlock*) total: 47 4.9e-04 */ | |
/* llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >::swap(llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >&) total: 269 0.0028 */ | |
/* std::pair<(anonymous namespace)::LVIValueHandle, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > >::pair<(anonymous namespace)::LVIValueHandle, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >, void>((anonymous namespace)::LVIValueHandle&&, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >&&) total: 29 3.0e-04 */ | |
/* std::_Rb_tree_iterator<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > > std::_Rb_tree<(anonymous namespace)::LVIValueHandle, std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > >, std::_Select1st<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > >, std::less<(anonymous namespace)::LVIValueHandle>, std::allocator<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > > >::_M_insert_<std::pair<(anonymous namespace)::LVIValueHandle, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > >(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair<(anonymous namespace)::LVIValueHandle, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > >&&) total: 78 8.2e-04 */ | |
/* std::pair<std::_Rb_tree_iterator<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > >, bool> std::_Rb_tree<(anonymous namespace)::LVIValueHandle, std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > >, std::_Select1st<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > >, std::less<(anonymous namespace)::LVIValueHandle>, std::allocator<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > > >::_M_insert_unique<std::pair<(anonymous namespace)::LVIValueHandle, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > >(std::pair<(anonymous namespace)::LVIValueHandle, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > >&&) total: 10 1.0e-04 */ | |
/* std::map<(anonymous namespace)::LVIValueHandle, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> >, std::less<(anonymous namespace)::LVIValueHandle>, std::allocator<std::pair<(anonymous namespace)::LVIValueHandle const, llvm::SmallDenseMap<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal, 4u, llvm::DenseMapInfo<llvm::AssertingVH<llvm::BasicBlock> >, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::BasicBlock>, (anonymous namespace)::LVILatticeVal> > > > >::operator[]((anonymous namespace)::LVIValueHandle&&) total: 467 0.0049 */ | |
/* (anonymous namespace)::LazyValueInfoCache::lookup(llvm::Value*) total: 146 0.0015 */ | |
/* (anonymous namespace)::LazyValueInfoCache::getCachedValueInfo(llvm::Value*, llvm::BasicBlock*) total: 423 0.0044 */ | |
/* (anonymous namespace)::LazyValueInfoCache::LazyValueInfoCache(llvm::AssumptionCache*, llvm::DataLayout const&, llvm::DominatorTree*) total: 66 6.9e-04 */ | |
/* (anonymous namespace)::LVIValueHandle::deleted() total: 37 3.9e-04 */ | |
/* (anonymous namespace)::LVIValueHandle::allUsesReplacedWith(llvm::Value*) total: 2 2.1e-05 */ | |
/* InstructionDereferencesPointer(llvm::Instruction*, llvm::Value*) total: 2689 0.0282 */ | |
/* isObjectDereferencedInBlock(llvm::Value*, llvm::BasicBlock*) total: 697 0.0073 */ | |
/* (anonymous namespace)::LazyValueInfoCache::getBlockValue(llvm::Value*, llvm::BasicBlock*) total: 390 0.0041 */ | |
/* (anonymous namespace)::LazyValueInfoCache::insertResult(llvm::Value*, llvm::BasicBlock*, (anonymous namespace)::LVILatticeVal const&) total: 639 0.0067 */ | |
/* (anonymous namespace)::LazyValueInfoCache::pushBlockValue(std::pair<llvm::BasicBlock*, llvm::Value*> const&) total: 377 0.0040 */ | |
/* (anonymous namespace)::LazyValueInfoCache::solveBlockValueSelect((anonymous namespace)::LVILatticeVal&, llvm::SelectInst*, llvm::BasicBlock*) total: 13 1.4e-04 */ | |
/* (anonymous namespace)::LazyValueInfoCache::getEdgeValue(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, (anonymous namespace)::LVILatticeVal&, llvm::Instruction*) [clone .part.445] total: 1164 0.0122 */ | |
/* (anonymous namespace)::LazyValueInfoCache::getEdgeValue(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, (anonymous namespace)::LVILatticeVal&, llvm::Instruction*) total: 148 0.0016 */ | |
/* (anonymous namespace)::LazyValueInfoCache::solveBlockValuePHINode((anonymous namespace)::LVILatticeVal&, llvm::PHINode*, llvm::BasicBlock*) total: 154 0.0016 */ | |
/* (anonymous namespace)::LazyValueInfoCache::solveBlockValueNonLocal((anonymous namespace)::LVILatticeVal&, llvm::Value*, llvm::BasicBlock*) total: 1861 0.0195 */ | |
/* (anonymous namespace)::LazyValueInfoCache::solve() total: 4550 0.0478 */ | |
/* (anonymous namespace)::LazyValueInfoCache::getValueOnEdge(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, llvm::Instruction*) total: 175 0.0018 */ | |
/* (anonymous namespace)::LazyValueInfoCache::getValueInBlock(llvm::Value*, llvm::BasicBlock*, llvm::Instruction*) total: 183 0.0019 */ | |
/* (anonymous namespace)::LazyValueInfoCache::threadEdge(llvm::BasicBlock*, llvm::BasicBlock*, llvm::BasicBlock*) [clone .isra.460] total: 24 2.5e-04 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.4/src/reactor/mod.rs" | |
* | |
* 28616 0.3005 | |
*/ | |
://! The core reactor driving all I/O | |
://! | |
://! This module contains the `Core` type which is the reactor for all I/O | |
://! happening in `tokio-core`. This reactor (or event loop) is used to run | |
://! futures, schedule tasks, issue I/O requests, etc. | |
: | |
:use std::cell::RefCell; | |
:use std::cmp; | |
:use std::io::{self, ErrorKind}; | |
:use std::mem; | |
:use std::rc::{Rc, Weak}; | |
:use std::sync::Arc; | |
:use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; | |
:use std::time::{Instant, Duration}; | |
: | |
:use futures::{self, Future, IntoFuture, Async}; | |
:use futures::executor::{self, Spawn, Unpark}; | |
:use futures::sync::mpsc; | |
:use futures::task::Task; | |
:use mio; | |
:use slab::Slab; | |
: | |
:use heap::{Heap, Slot}; | |
: | |
:mod io_token; | |
:mod timeout_token; | |
: | |
:mod poll_evented; | |
:mod timeout; | |
:mod interval; | |
:pub use self::poll_evented::PollEvented; | |
:pub use self::timeout::Timeout; | |
:pub use self::interval::Interval; | |
: | |
:static NEXT_LOOP_ID: AtomicUsize = ATOMIC_USIZE_INIT; | |
:scoped_thread_local!(static CURRENT_LOOP: Core); | |
: | |
:/// An event loop. | |
:/// | |
:/// The event loop is the main source of blocking in an application which drives | |
:/// all other I/O events and notifications happening. Each event loop can have | |
:/// multiple handles pointing to it, each of which can then be used to create | |
:/// various I/O objects to interact with the event loop in interesting ways. | |
:// TODO: expand this | |
:pub struct Core { | |
: events: mio::Events, | |
: tx: mpsc::UnboundedSender<Message>, | |
: rx: RefCell<Spawn<mpsc::UnboundedReceiver<Message>>>, | |
: _rx_registration: mio::Registration, | |
: rx_readiness: Arc<MySetReadiness>, | |
: | |
: inner: Rc<RefCell<Inner>>, | |
: | |
: // Used for determining when the future passed to `run` is ready. Once the | |
: // registration is passed to `io` above we never touch it again, just keep | |
: // it alive. | |
: _future_registration: mio::Registration, | |
: future_readiness: Arc<MySetReadiness>, | |
:} | |
: | |
:struct Inner { | |
: id: usize, | |
: io: mio::Poll, | |
: | |
: // Dispatch slabs for I/O and futures events | |
: io_dispatch: Slab<ScheduledIo>, | |
: task_dispatch: Slab<ScheduledTask>, | |
: | |
: // Timer wheel keeping track of all timeouts. The `usize` stored in the | |
: // timer wheel is an index into the slab below. | |
: // | |
: // The slab below keeps track of the timeouts themselves as well as the | |
: // state of the timeout itself. The `TimeoutToken` type is an index into the | |
: // `timeouts` slab. | |
: timer_heap: Heap<(Instant, usize)>, | |
: timeouts: Slab<(Option<Slot>, TimeoutState)>, | |
:} | |
: | |
:/// An unique ID for a Core | |
:/// | |
:/// An ID by which different cores may be distinguished. Can be compared and used as an index in | |
:/// a `HashMap`. | |
:/// | |
:/// The ID is globally unique and never reused. | |
:#[derive(Clone,Copy,Eq,PartialEq,Hash,Debug)] | |
:pub struct CoreId(usize); | |
: | |
:/// Handle to an event loop, used to construct I/O objects, send messages, and | |
:/// otherwise interact indirectly with the event loop itself. | |
:/// | |
:/// Handles can be cloned, and when cloned they will still refer to the | |
:/// same underlying event loop. | |
:#[derive(Clone)] | |
:pub struct Remote { | |
: id: usize, | |
: tx: mpsc::UnboundedSender<Message>, | |
:} | |
: | |
:/// A non-sendable handle to an event loop, useful for manufacturing instances | |
:/// of `LoopData`. | |
:#[derive(Clone)] | |
:pub struct Handle { | |
: remote: Remote, | |
: inner: Weak<RefCell<Inner>>, | |
:} | |
: | |
:struct ScheduledIo { | |
: readiness: Arc<AtomicUsize>, | |
: reader: Option<Task>, | |
: writer: Option<Task>, | |
:} | |
: | |
:struct ScheduledTask { | |
: _registration: mio::Registration, | |
: spawn: Option<Spawn<Box<Future<Item=(), Error=()>>>>, | |
: wake: Arc<MySetReadiness>, | |
:} | |
: | |
:enum TimeoutState { | |
: NotFired, | |
: Fired, | |
: Waiting(Task), | |
:} | |
: | |
:enum Direction { | |
: Read, | |
: Write, | |
:} | |
: | |
:enum Message { | |
: DropSource(usize), | |
: Schedule(usize, Task, Direction), | |
: UpdateTimeout(usize, Task), | |
: ResetTimeout(usize, Instant), | |
: CancelTimeout(usize), | |
: Run(Box<FnBox>), | |
:} | |
: | |
:const TOKEN_MESSAGES: mio::Token = mio::Token(0); | |
:const TOKEN_FUTURE: mio::Token = mio::Token(1); | |
:const TOKEN_START: usize = 2; | |
: | |
:impl Core { | |
: /// Creates a new event loop, returning any error that happened during the | |
: /// creation. | |
: pub fn new() -> io::Result<Core> { | |
: let io = try!(mio::Poll::new()); | |
: let future_pair = mio::Registration::new(&io, | |
: TOKEN_FUTURE, | |
: mio::Ready::readable(), | |
: mio::PollOpt::level()); | |
: let (tx, rx) = mpsc::unbounded(); | |
: let channel_pair = mio::Registration::new(&io, | |
: TOKEN_MESSAGES, | |
: mio::Ready::readable(), | |
: mio::PollOpt::level()); | |
: let rx_readiness = Arc::new(MySetReadiness(channel_pair.1)); | |
: rx_readiness.unpark(); | |
: | |
: Ok(Core { | |
: events: mio::Events::with_capacity(1024), | |
: tx: tx, | |
: rx: RefCell::new(executor::spawn(rx)), | |
: _rx_registration: channel_pair.0, | |
: rx_readiness: rx_readiness, | |
: | |
: _future_registration: future_pair.0, | |
: future_readiness: Arc::new(MySetReadiness(future_pair.1)), | |
: | |
: inner: Rc::new(RefCell::new(Inner { | |
: id: NEXT_LOOP_ID.fetch_add(1, Ordering::Relaxed), | |
: io: io, | |
: io_dispatch: Slab::with_capacity(1), | |
: task_dispatch: Slab::with_capacity(1), | |
: timeouts: Slab::with_capacity(1), | |
: timer_heap: Heap::new(), | |
: })), | |
: }) | |
: } | |
: | |
: /// Returns a handle to this event loop which cannot be sent across threads | |
: /// but can be used as a proxy to the event loop itself. | |
: /// | |
: /// Handles are cloneable and clones always refer to the same event loop. | |
: /// This handle is typically passed into functions that create I/O objects | |
: /// to bind them to this event loop. | |
: pub fn handle(&self) -> Handle { | |
: Handle { | |
: remote: self.remote(), | |
: inner: Rc::downgrade(&self.inner), | |
: } | |
: } | |
: | |
: /// Generates a remote handle to this event loop which can be used to spawn | |
: /// tasks from other threads into this event loop. | |
: pub fn remote(&self) -> Remote { | |
: Remote { | |
: id: self.inner.borrow().id, | |
: tx: self.tx.clone(), | |
: } | |
: } | |
: | |
: /// Runs a future until completion, driving the event loop while we're | |
: /// otherwise waiting for the future to complete. | |
: /// | |
: /// This function will begin executing the event loop and will finish once | |
: /// the provided future is resolve. Note that the future argument here | |
: /// crucially does not require the `'static` nor `Send` bounds. As a result | |
: /// the future will be "pinned" to not only this thread but also this stack | |
: /// frame. | |
: /// | |
: /// This function will returns the value that the future resolves to once | |
: /// the future has finished. If the future never resolves then this function | |
: /// will never return. | |
: /// | |
: /// # Panics | |
: /// | |
: /// This method will **not** catch panics from polling the future `f`. If | |
: /// the future panics then it's the responsibility of the caller to catch | |
: /// that panic and handle it as appropriate. | |
: pub fn run<F>(&mut self, f: F) -> Result<F::Item, F::Error> | |
: where F: Future, | |
: { | |
: let mut task = executor::spawn(f); | |
: let ready = self.future_readiness.clone(); | |
: let mut future_fired = true; | |
: | |
: loop { | |
1150 0.0121 : if future_fired { | |
: let res = try!(CURRENT_LOOP.set(self, || { | |
: task.poll_future(ready.clone()) | |
: })); | |
: if let Async::Ready(e) = res { | |
: return Ok(e) | |
: } | |
: } | |
3105 0.0326 : future_fired = self.poll(None); | |
: } | |
: } | |
: | |
: /// Performs one iteration of the event loop, blocking on waiting for events | |
: /// for at most `max_wait` (forever if `None`). | |
: /// | |
: /// It only makes sense to call this method if you've previously spawned | |
: /// a future onto this event loop. | |
: /// | |
: /// `loop { lp.turn(None) }` is equivalent to calling `run` with an | |
: /// empty future (one that never finishes). | |
: pub fn turn(&mut self, max_wait: Option<Duration>) { | |
: self.poll(max_wait); | |
: } | |
: | |
4751 0.0499 : fn poll(&mut self, max_wait: Option<Duration>) -> bool { /* tokio_core::reactor::Core::poll::haa3b4a884a84ba78 total: 61300 0.6436 */ | |
: // Given the `max_wait` variable specified, figure out the actual | |
: // timeout that we're going to pass to `poll`. This involves taking a | |
: // look at active timers on our heap as well. | |
171 0.0018 : let start = Instant::now(); | |
: let timeout = self.inner.borrow_mut().timer_heap.peek().map(|t| { | |
: if t.0 < start { | |
: Duration::new(0, 0) | |
: } else { | |
: t.0 - start | |
: } | |
: }); | |
: let timeout = match (max_wait, timeout) { | |
: (Some(d1), Some(d2)) => Some(cmp::min(d1, d2)), | |
: (max_wait, timeout) => max_wait.or(timeout), | |
: }; | |
: | |
: // Block waiting for an event to happen, peeling out how many events | |
: // happened. | |
729 0.0077 : let amt = match self.inner.borrow_mut().io.poll(&mut self.events, timeout) { | |
1011 0.0106 : Ok(a) => a, | |
: Err(ref e) if e.kind() == ErrorKind::Interrupted => return false, | |
: Err(e) => panic!("error in poll: {}", e), | |
: }; | |
: | |
244 0.0026 : let after_poll = Instant::now(); | |
: debug!("loop poll - {:?}", after_poll - start); | |
: debug!("loop time - {:?}", after_poll); | |
: | |
: // Process all timeouts that may have just occurred, updating the | |
: // current time since | |
928 0.0097 : self.consume_timeouts(after_poll); | |
: | |
: // Process all the events that came in, dispatching appropriately | |
: let mut fired = false; | |
134 0.0014 : for i in 0..self.events.len() { | |
151 0.0016 : let event = self.events.get(i).unwrap(); | |
259 0.0027 : let token = event.token(); | |
: trace!("event {:?} {:?}", event.kind(), event.token()); | |
: | |
1831 0.0192 : if token == TOKEN_MESSAGES { | |
: self.rx_readiness.0.set_readiness(mio::Ready::none()).unwrap(); | |
: CURRENT_LOOP.set(&self, || self.consume_queue()); | |
: } else if token == TOKEN_FUTURE { | |
: self.future_readiness.0.set_readiness(mio::Ready::none()).unwrap(); | |
: fired = true; | |
: } else { | |
566 0.0059 : self.dispatch(token, event.kind()); | |
: } | |
: } | |
317 0.0033 : debug!("loop process - {} events, {:?}", amt, after_poll.elapsed()); | |
392 0.0041 : return fired | |
1236 0.0130 : } | |
: | |
: fn dispatch(&mut self, token: mio::Token, ready: mio::Ready) { | |
112 0.0012 : let token = usize::from(token) - TOKEN_START; | |
82 8.6e-04 : if token % 2 == 0 { | |
198 0.0021 : self.dispatch_io(token / 2, ready) | |
: } else { | |
1495 0.0157 : self.dispatch_task(token / 2) | |
: } | |
: } | |
: | |
: fn dispatch_io(&mut self, token: usize, ready: mio::Ready) { | |
10 1.0e-04 : let mut reader = None; | |
73 7.7e-04 : let mut writer = None; | |
: let mut inner = self.inner.borrow_mut(); | |
30 3.1e-04 : if let Some(io) = inner.io_dispatch.get_mut(token) { | |
: if ready.is_readable() || ready.is_hup() { | |
: reader = io.reader.take(); | |
: io.readiness.fetch_or(1, Ordering::Relaxed); | |
: } | |
: if ready.is_writable() { | |
: writer = io.writer.take(); | |
: io.readiness.fetch_or(2, Ordering::Relaxed); | |
: } | |
: } | |
: drop(inner); | |
: // TODO: don't notify the same task twice | |
: if let Some(reader) = reader { | |
1 1.0e-05 : self.notify_handle(reader); | |
: } | |
22 2.3e-04 : if let Some(writer) = writer { | |
15 1.6e-04 : self.notify_handle(writer); | |
: } | |
1 1.0e-05 : } | |
: | |
: fn dispatch_task(&mut self, token: usize) { | |
: let mut inner = self.inner.borrow_mut(); | |
413 0.0043 : let (task, wake) = match inner.task_dispatch.get_mut(token) { | |
359 0.0038 : Some(slot) => (slot.spawn.take(), slot.wake.clone()), | |
: None => return, | |
: }; | |
1733 0.0182 : wake.0.set_readiness(mio::Ready::none()).unwrap(); | |
: let mut task = match task { | |
421 0.0044 : Some(task) => task, | |
: None => return, | |
: }; | |
: drop(inner); | |
: let res = CURRENT_LOOP.set(self, || task.poll_future(wake)); | |
: inner = self.inner.borrow_mut(); | |
: match res { | |
126 0.0013 : Ok(Async::NotReady) => { | |
13 1.4e-04 : assert!(inner.task_dispatch[token].spawn.is_none()); | |
709 0.0074 : inner.task_dispatch[token].spawn = Some(task); | |
: } | |
: Ok(Async::Ready(())) | | |
: Err(()) => { | |
: inner.task_dispatch.remove(token).unwrap(); | |
: } | |
: } | |
: } | |
: | |
1787 0.0188 : fn consume_timeouts(&mut self, now: Instant) { | |
: loop { | |
: let mut inner = self.inner.borrow_mut(); | |
: match inner.timer_heap.peek() { | |
181 0.0019 : Some(head) if head.0 <= now => {} | |
: Some(_) => break, | |
: None => break, | |
: }; | |
: let (_, slab_idx) = inner.timer_heap.pop().unwrap(); | |
: | |
: trace!("firing timeout: {}", slab_idx); | |
: inner.timeouts[slab_idx].0.take().unwrap(); | |
: let handle = inner.timeouts[slab_idx].1.fire(); | |
: drop(inner); | |
: if let Some(handle) = handle { | |
: self.notify_handle(handle); | |
: } | |
: } | |
: } | |
: | |
: /// Method used to notify a task handle. | |
: /// | |
: /// Note that this should be used instead of `handle.unpark()` to ensure | |
: /// that the `CURRENT_LOOP` variable is set appropriately. | |
7 7.3e-05 : fn notify_handle(&self, handle: Task) { /* tokio_core::reactor::Core::notify_handle::h198ee0d2c7cdc826 total: 25 2.6e-04 */ | |
: debug!("notifying a task handle"); | |
: CURRENT_LOOP.set(&self, || handle.unpark()); | |
3 3.1e-05 : } | |
: | |
1 1.0e-05 : fn consume_queue(&self) { /* tokio_core::reactor::Core::consume_queue::haeecce7e642b4358 total: 131 0.0014 */ | |
: debug!("consuming notification queue"); | |
: // TODO: can we do better than `.unwrap()` here? | |
: let unpark = self.rx_readiness.clone(); | |
: loop { | |
: match self.rx.borrow_mut().poll_stream(unpark.clone()).unwrap() { | |
8 8.4e-05 : Async::Ready(Some(msg)) => self.notify(msg), | |
: Async::NotReady | | |
: Async::Ready(None) => break, | |
: } | |
1 1.0e-05 : } | |
: } | |
: | |
14 1.5e-04 : fn notify(&self, msg: Message) { /* tokio_core::reactor::Core::notify::hb7a069e850c52f52 total: 97 0.0010 */ | |
: match msg { | |
9 9.4e-05 : Message::DropSource(tok) => self.inner.borrow_mut().drop_source(tok), | |
20 2.1e-04 : Message::Schedule(tok, wake, dir) => { | |
3 3.1e-05 : let task = self.inner.borrow_mut().schedule(tok, wake, dir); | |
2 2.1e-05 : if let Some(task) = task { | |
3 3.1e-05 : self.notify_handle(task); | |
: } | |
: } | |
: Message::UpdateTimeout(t, handle) => { | |
: let task = self.inner.borrow_mut().update_timeout(t, handle); | |
: if let Some(task) = task { | |
: self.notify_handle(task); | |
: } | |
: } | |
: Message::ResetTimeout(t, at) => { | |
: self.inner.borrow_mut().reset_timeout(t, at); | |
: } | |
: Message::CancelTimeout(t) => { | |
: self.inner.borrow_mut().cancel_timeout(t) | |
: } | |
: Message::Run(r) => r.call_box(self), | |
: } | |
8 8.4e-05 : } | |
: | |
: /// Get the ID of this loop | |
: pub fn id(&self) -> CoreId { | |
: CoreId(self.inner.borrow().id) | |
: } | |
:} | |
: | |
:impl Inner { | |
: fn add_source(&mut self, source: &mio::Evented) | |
: -> io::Result<(Arc<AtomicUsize>, usize)> { | |
: debug!("adding a new I/O source"); | |
: let sched = ScheduledIo { | |
: readiness: Arc::new(AtomicUsize::new(0)), | |
: reader: None, | |
: writer: None, | |
: }; | |
: if self.io_dispatch.vacant_entry().is_none() { | |
: let amt = self.io_dispatch.len(); | |
: self.io_dispatch.reserve_exact(amt); | |
: } | |
: let entry = self.io_dispatch.vacant_entry().unwrap(); | |
: try!(self.io.register(source, | |
: mio::Token(TOKEN_START + entry.index() * 2), | |
: mio::Ready::readable() | mio::Ready::writable() | mio::Ready::hup(), | |
: mio::PollOpt::edge())); | |
: Ok((sched.readiness.clone(), entry.insert(sched).index())) | |
: } | |
: | |
: fn deregister_source(&mut self, source: &mio::Evented) -> io::Result<()> { | |
: self.io.deregister(source) | |
: } | |
: | |
: fn drop_source(&mut self, token: usize) { | |
: debug!("dropping I/O source: {}", token); | |
: self.io_dispatch.remove(token).unwrap(); | |
: } | |
: | |
3 3.1e-05 : fn schedule(&mut self, token: usize, wake: Task, dir: Direction) | |
: -> Option<Task> { | |
: debug!("scheduling direction for: {}", token); | |
: let sched = self.io_dispatch.get_mut(token).unwrap(); | |
: let (slot, bit) = match dir { | |
1 1.0e-05 : Direction::Read => (&mut sched.reader, 1), | |
: Direction::Write => (&mut sched.writer, 2), | |
: }; | |
18 1.9e-04 : if sched.readiness.load(Ordering::SeqCst) & bit != 0 { | |
5 5.2e-05 : *slot = None; | |
1 1.0e-05 : Some(wake) | |
: } else { | |
2 2.1e-05 : *slot = Some(wake); | |
: None | |
: } | |
: } | |
: | |
: fn add_timeout(&mut self, at: Instant) -> usize { | |
: if self.timeouts.vacant_entry().is_none() { | |
: let len = self.timeouts.len(); | |
: self.timeouts.reserve_exact(len); | |
: } | |
: let entry = self.timeouts.vacant_entry().unwrap(); | |
: let slot = self.timer_heap.push((at, entry.index())); | |
: let entry = entry.insert((Some(slot), TimeoutState::NotFired)); | |
: debug!("added a timeout: {}", entry.index()); | |
: return entry.index(); | |
: } | |
: | |
: fn update_timeout(&mut self, token: usize, handle: Task) -> Option<Task> { | |
: debug!("updating a timeout: {}", token); | |
: self.timeouts[token].1.block(handle) | |
: } | |
: | |
: fn reset_timeout(&mut self, token: usize, at: Instant) { | |
: let pair = &mut self.timeouts[token]; | |
: // TODO: avoid remove + push and instead just do one sift of the heap? | |
: // In theory we could update it in place and then do the percolation | |
: // as necessary | |
: if let Some(slot) = pair.0.take() { | |
: self.timer_heap.remove(slot); | |
: } | |
: let slot = self.timer_heap.push((at, token)); | |
: *pair = (Some(slot), TimeoutState::NotFired); | |
: debug!("set a timeout: {}", token); | |
: } | |
: | |
: fn cancel_timeout(&mut self, token: usize) { | |
: debug!("cancel a timeout: {}", token); | |
: let pair = self.timeouts.remove(token); | |
: if let Some((Some(slot), _state)) = pair { | |
: self.timer_heap.remove(slot); | |
: } | |
: } | |
: | |
: fn spawn(&mut self, future: Box<Future<Item=(), Error=()>>) { | |
: if self.task_dispatch.vacant_entry().is_none() { | |
: let len = self.task_dispatch.len(); | |
: self.task_dispatch.reserve_exact(len); | |
: } | |
: let entry = self.task_dispatch.vacant_entry().unwrap(); | |
: let token = TOKEN_START + 2 * entry.index() + 1; | |
: let pair = mio::Registration::new(&self.io, | |
: mio::Token(token), | |
: mio::Ready::readable(), | |
: mio::PollOpt::level()); | |
: let unpark = Arc::new(MySetReadiness(pair.1)); | |
: let entry = entry.insert(ScheduledTask { | |
: spawn: Some(executor::spawn(future)), | |
: wake: unpark, | |
: _registration: pair.0, | |
: }); | |
: entry.get().wake.clone().unpark(); | |
: } | |
:} | |
: | |
:impl Remote { | |
10 1.0e-04 : fn send(&self, msg: Message) { /* tokio_core::reactor::Remote::send::he6529cd2660a0a64 total: 59 6.2e-04 */ | |
19 2.0e-04 : self.with_loop(|lp| { /* tokio_core::reactor::Remote::send::_$u7b$$u7b$closure$u7d$$u7d$::h562bbd42ec5d7cc3 total: 38 4.0e-04 */ | |
: match lp { | |
1 1.0e-05 : Some(lp) => { | |
: // Need to execute all existing requests first, to ensure | |
: // that our message is processed "in order" | |
: lp.consume_queue(); | |
: lp.notify(msg); | |
: } | |
: None => { | |
6 6.3e-05 : match mpsc::UnboundedSender::send(&self.tx, msg) { | |
: Ok(()) => {} | |
: | |
: // TODO: this error should punt upwards and we should | |
: // notify the caller that the message wasn't | |
: // received. This is tokio-core#17 | |
: Err(e) => drop(e), | |
: } | |
: } | |
: } | |
6 6.3e-05 : }) | |
5 5.2e-05 : } | |
: | |
7 7.3e-05 : fn with_loop<F, R>(&self, f: F) -> R | |
: where F: FnOnce(Option<&Core>) -> R | |
: { | |
: if CURRENT_LOOP.is_set() { | |
: CURRENT_LOOP.with(|lp| { | |
1 1.0e-05 : let same = lp.inner.borrow().id == self.id; | |
: if same { | |
: f(Some(lp)) | |
: } else { | |
20 2.1e-04 : f(None) | |
: } | |
: }) | |
: } else { | |
: f(None) | |
: } | |
: } | |
: | |
: /// Spawns a new future into the event loop this remote is associated with. | |
: /// | |
: /// This function takes a closure which is executed within the context of | |
: /// the I/O loop itself. The future returned by the closure will be | |
: /// scheduled on the event loop an run to completion. | |
: /// | |
: /// Note that while the closure, `F`, requires the `Send` bound as it might | |
: /// cross threads, the future `R` does not. | |
: pub fn spawn<F, R>(&self, f: F) | |
: where F: FnOnce(&Handle) -> R + Send + 'static, | |
: R: IntoFuture<Item=(), Error=()>, | |
: R::Future: 'static, | |
: { | |
: self.send(Message::Run(Box::new(|lp: &Core| { | |
: let f = f(&lp.handle()); | |
: lp.inner.borrow_mut().spawn(Box::new(f.into_future())); | |
: }))); | |
: } | |
: | |
: /// Return the ID of the represented Core | |
: pub fn id(&self) -> CoreId { | |
: CoreId(self.id) | |
: } | |
: | |
: /// Attempts to "promote" this remote to a handle, if possible. | |
: /// | |
: /// This function is intended for structures which typically work through a | |
: /// `Remote` but want to optimize runtime when the remote doesn't actually | |
: /// leave the thread of the original reactor. This will attempt to return a | |
: /// handle if the `Remote` is on the same thread as the event loop and the | |
: /// event loop is running. | |
: /// | |
: /// If this `Remote` has moved to a different thread or if the event loop is | |
: /// running, then `None` may be returned. If you need to guarantee access to | |
: /// a `Handle`, then you can call this function and fall back to using | |
: /// `spawn` above if it returns `None`. | |
: pub fn handle(&self) -> Option<Handle> { | |
: if CURRENT_LOOP.is_set() { | |
: CURRENT_LOOP.with(|lp| { | |
: let same = lp.inner.borrow().id == self.id; | |
: if same { | |
: Some(lp.handle()) | |
: } else { | |
: None | |
: } | |
: }) | |
: } else { | |
: None | |
: } | |
: } | |
:} | |
: | |
:impl Handle { | |
: /// Returns a reference to the underlying remote handle to the event loop. | |
: pub fn remote(&self) -> &Remote { | |
: &self.remote | |
: } | |
: | |
: /// Spawns a new future on the event loop this handle is associated with. | |
: pub fn spawn<F>(&self, f: F) | |
: where F: Future<Item=(), Error=()> + 'static, | |
: { | |
: let inner = match self.inner.upgrade() { | |
: Some(inner) => inner, | |
: None => return, | |
: }; | |
: inner.borrow_mut().spawn(Box::new(f)); | |
: } | |
: | |
: /// Spawns a closure on this event loop. | |
: /// | |
: /// This function is a convenience wrapper around the `spawn` function above | |
: /// for running a closure wrapped in `futures::lazy`. It will spawn the | |
: /// function `f` provided onto the event loop, and continue to run the | |
: /// future returned by `f` on the event loop as well. | |
: pub fn spawn_fn<F, R>(&self, f: F) | |
: where F: FnOnce() -> R + 'static, | |
: R: IntoFuture<Item=(), Error=()> + 'static, | |
: { | |
: self.spawn(futures::lazy(f)) | |
: } | |
: | |
: /// Return the ID of the represented Core | |
: pub fn id(&self) -> CoreId { | |
: self.remote.id() | |
: } | |
:} | |
: | |
:impl TimeoutState { | |
: fn block(&mut self, handle: Task) -> Option<Task> { | |
: match *self { | |
: TimeoutState::Fired => return Some(handle), | |
: _ => {} | |
: } | |
: *self = TimeoutState::Waiting(handle); | |
: None | |
: } | |
: | |
: fn fire(&mut self) -> Option<Task> { | |
: match mem::replace(self, TimeoutState::Fired) { | |
: TimeoutState::NotFired => None, | |
: TimeoutState::Fired => panic!("fired twice?"), | |
: TimeoutState::Waiting(handle) => Some(handle), | |
: } | |
: } | |
:} | |
: | |
:struct MySetReadiness(mio::SetReadiness); | |
: | |
:impl Unpark for MySetReadiness { | |
1947 0.0204 : fn unpark(&self) { /* _$LT$tokio_core..reactor..MySetReadiness$u20$as$u20$futures..task_impl..Unpark$GT$::unpark::hc70043fbae23cdee total: 5021 0.0527 */ | |
1144 0.0120 : self.0.set_readiness(mio::Ready::readable()) | |
: .expect("failed to set readiness"); | |
585 0.0061 : } | |
:} | |
: | |
:trait FnBox: Send + 'static { | |
: fn call_box(self: Box<Self>, lp: &Core); | |
:} | |
: | |
:impl<F: FnOnce(&Core) + Send + 'static> FnBox for F { | |
: fn call_box(self: Box<Self>, lp: &Core) { | |
: (*self)(lp) | |
: } | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-proto-0.1.0/src/buffer_one.rs" | |
* | |
* 27758 0.2915 | |
*/ | |
:#![allow(unused)] | |
: | |
:use futures::{Poll, Async}; | |
:use futures::{StartSend, AsyncSink}; | |
:use futures::sink::Sink; | |
:use futures::stream::Stream; | |
:use futures::task::{self, Task}; | |
: | |
:#[must_use = "sinks do nothing unless polled"] | |
:pub struct BufferOne<S: Sink> { | |
: sink: S, | |
: buf: Option<S::SinkItem>, | |
: task: Option<Task>, | |
:} | |
: | |
:impl<S: Sink> BufferOne<S> { | |
: pub fn new(sink: S) -> BufferOne<S> { | |
: BufferOne { | |
: sink: sink, | |
: buf: None, | |
: task: None, | |
: } | |
: } | |
: | |
: /// Get a shared reference to the inner sink. | |
: pub fn get_ref(&self) -> &S { | |
: &self.sink | |
: } | |
: | |
: /// Get a mutable reference to the inner sink. | |
: pub fn get_mut(&mut self) -> &mut S { | |
: &mut self.sink | |
: } | |
: | |
: pub fn poll_ready(&mut self) -> Async<()> { | |
761 0.0080 : if self.buf.is_none() { | |
: return Async::Ready(()); | |
: } | |
: | |
3920 0.0412 : self.task = Some(task::park()); | |
: Async::NotReady | |
: } | |
: | |
5117 0.0537 : fn try_empty_buffer(&mut self) -> Poll<(), S::SinkError> { /* _$LT$tokio_proto..buffer_one..BufferOne$LT$S$GT$$GT$::try_empty_buffer::h01052cdbd7ea2aa2 17743 0.1863, _$LT$tokio_proto..buffer_one..BufferOne$LT$S$GT$$GT$::try_empty_buffer::h2e18ad791e30a85f 4937 0.0518, total: 22680 0.2381 */ | |
1679 0.0176 : if let Some(buf) = self.buf.take() { | |
3148 0.0331 : if let AsyncSink::NotReady(buf) = try!(self.sink.start_send(buf)) { | |
: self.buf = Some(buf); | |
: return Ok(Async::NotReady); | |
: } | |
: | |
: // Unpark any pending tasks | |
: self.task.take() | |
835 0.0088 : .map(|t| t.unpark()); | |
: } | |
: | |
619 0.0065 : Ok(Async::Ready(())) | |
1736 0.0182 : } | |
:} | |
: | |
:// Forwarding impl of Stream from the underlying sink | |
:impl<S> Stream for BufferOne<S> where S: Sink + Stream { | |
: type Item = S::Item; | |
: type Error = S::Error; | |
: | |
: fn poll(&mut self) -> Poll<Option<S::Item>, S::Error> { | |
: self.sink.poll() | |
: } | |
:} | |
: | |
:impl<S: Sink> Sink for BufferOne<S> { | |
: type SinkItem = S::SinkItem; | |
: type SinkError = S::SinkError; | |
: | |
1469 0.0154 : fn start_send(&mut self, item: Self::SinkItem) -> StartSend<Self::SinkItem, Self::SinkError> { | |
495 0.0052 : if !try!(self.try_empty_buffer()).is_ready() { | |
: return Ok(AsyncSink::NotReady(item)); | |
: } | |
: | |
1243 0.0131 : if let AsyncSink::NotReady(item) = try!(self.sink.start_send(item)) { | |
3465 0.0364 : self.buf = Some(item); | |
1408 0.0148 : } | |
: | |
804 0.0084 : Ok(AsyncSink::Ready) | |
: } | |
: | |
: fn poll_complete(&mut self) -> Poll<(), Self::SinkError> { | |
837 0.0088 : let mut flushed = try!(self.try_empty_buffer()).is_ready(); | |
222 0.0023 : flushed &= try!(self.sink.poll_complete()).is_ready(); | |
: | |
: if flushed { | |
: Ok(Async::Ready(())) | |
: } else { | |
: Ok(Async::NotReady) | |
: } | |
: } | |
:} | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/elf/dl-lookup.c" | |
* | |
* 25498 0.2677 | |
*/ | |
/* do_lookup_x total: 16248 0.1706 */ | |
/* check_match.9481 total: 8905 0.0935 */ | |
/* _dl_lookup_symbol_x total: 2722 0.0286 */ | |
/* _dl_setup_hash total: 10 1.0e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/mem.rs" | |
* | |
* 24729 0.2597 | |
*/ | |
/* core::mem::drop::hc6c3ee742bd66f9d total: 11 1.2e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/cmp.rs" | |
* | |
* 24696 0.2593 | |
*/ | |
/* | |
* Total samples for file : "/checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/arena.h" | |
* | |
* 24130 0.2534 | |
*/ | |
/* arena_run_dirty_insert total: 3 3.1e-05 */ | |
/* arena_run_dirty_remove.isra.25 total: 1 1.0e-05 */ | |
/* arena_run_dirty_insert total: 75 7.9e-04 */ | |
/* arena_run_dirty_remove.isra.25 total: 154 0.0016 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/task_impl/mod.rs" | |
* | |
* 21939 0.2304 | |
*/ | |
:use std::prelude::v1::*; | |
: | |
:use std::cell::Cell; | |
:use std::fmt; | |
:use std::sync::Arc; | |
:use std::sync::atomic::{Ordering, AtomicBool, AtomicUsize, ATOMIC_USIZE_INIT}; | |
:use std::thread; | |
: | |
:use {Poll, Future, Async}; | |
:use future::BoxFuture; | |
:use stream::Stream; | |
: | |
:mod unpark_mutex; | |
:use self::unpark_mutex::UnparkMutex; | |
: | |
:mod task_rc; | |
:mod data; | |
:#[allow(deprecated)] | |
:#[cfg(feature = "with-deprecated")] | |
:pub use self::task_rc::TaskRc; | |
:pub use self::data::LocalKey; | |
: | |
:thread_local!(static CURRENT_TASK: Cell<(*const Task, *const data::LocalMap)> = { | |
: Cell::new((0 as *const _, 0 as *const _)) | |
:}); | |
: | |
:fn fresh_task_id() -> usize { | |
: // TODO: this assert is a real bummer, need to figure out how to reuse | |
: // old IDs that are no longer in use. | |
: static NEXT_ID: AtomicUsize = ATOMIC_USIZE_INIT; | |
: let id = NEXT_ID.fetch_add(1, Ordering::Relaxed); | |
: assert!(id < usize::max_value() / 2, | |
: "too many previous tasks have been allocated"); | |
: id | |
:} | |
: | |
:fn set<F, R>(task: &Task, data: &data::LocalMap, f: F) -> R | |
: where F: FnOnce() -> R | |
:{ | |
: struct Reset((*const Task, *const data::LocalMap)); | |
: impl Drop for Reset { | |
2583 0.0271 : fn drop(&mut self) { /* _$LT$futures..task_impl..set..Reset$u20$as$u20$core..ops..Drop$GT$::drop::h96649e4e1a8a379b total: 6888 0.0723 */ | |
75 7.9e-04 : CURRENT_TASK.with(|c| c.set(self.0)); | |
303 0.0032 : } | |
: } | |
: | |
: CURRENT_TASK.with(|c| { | |
137 0.0014 : let _reset = Reset(c.get()); | |
: c.set((task as *const _, data as *const _)); | |
102 0.0011 : f() | |
806 0.0085 : }) | |
:} | |
: | |
:fn with<F: FnOnce(&Task, &data::LocalMap) -> R, R>(f: F) -> R { | |
: let (task, data) = CURRENT_TASK.with(|c| c.get()); | |
878 0.0092 : assert!(!task.is_null(), "no Task is currently running"); | |
: debug_assert!(!data.is_null()); | |
: unsafe { | |
: f(&*task, &*data) | |
: } | |
:} | |
: | |
:/// A handle to a "task", which represents a single lightweight "thread" of | |
:/// execution driving a future to completion. | |
:/// | |
:/// In general, futures are composed into large units of work, which are then | |
:/// spawned as tasks onto an *executor*. The executor is responsible for polling | |
:/// the future as notifications arrive, until the future terminates. | |
:/// | |
:/// This is obtained by the `task::park` function. | |
1768 0.0186 :#[derive(Clone)] | |
:pub struct Task { | |
: id: usize, | |
71 7.5e-04 : unpark: Arc<Unpark>, | |
: events: Events, | |
:} | |
: | |
:fn _assert_kinds() { | |
: fn _assert_send<T: Send>() {} | |
: _assert_send::<Task>(); | |
:} | |
: | |
:/// Returns a handle to the current task to call `unpark` at a later date. | |
:/// | |
:/// This function is similar to the standard library's `thread::park` function | |
:/// except that it won't block the current thread but rather the current future | |
:/// that is being executed. | |
:/// | |
:/// The returned handle implements the `Send` and `'static` bounds and may also | |
:/// be cheaply cloned. This is useful for squirreling away the handle into a | |
:/// location which is then later signaled that a future can make progress. | |
:/// | |
:/// Implementations of the `Future` trait typically use this function if they | |
:/// would otherwise perform a blocking operation. When something isn't ready | |
:/// yet, this `park` function is called to acquire a handle to the current | |
:/// task, and then the future arranges it such that when the block operation | |
:/// otherwise finishes (perhaps in the background) it will `unpark` the returned | |
:/// handle. | |
:/// | |
:/// It's sometimes necessary to pass extra information to the task when | |
:/// unparking it, so that the task knows something about *why* it was woken. See | |
:/// the `with_unpark_event` for details on how to do this. | |
:/// | |
:/// # Panics | |
:/// | |
:/// This function will panic if a task is not currently being executed. That | |
:/// is, this method can be dangerous to call outside of an implementation of | |
:/// `poll`. | |
4533 0.0476 :pub fn park() -> Task { /* futures::task_impl::park::h9aada23a74a6803f total: 30304 0.3182 */ | |
350 0.0037 : with(|task, _| task.clone()) | |
1347 0.0141 :} | |
: | |
:impl Task { | |
: /// Indicate that the task should attempt to poll its future in a timely | |
: /// fashion. | |
: /// | |
: /// It's typically guaranteed that, for each call to `unpark`, `poll` will | |
: /// be called at least once subsequently (unless the task has terminated). | |
: /// If the task is currently polling its future when `unpark` is called, it | |
: /// must poll the future *again* afterwards, ensuring that all relevant | |
: /// events are eventually observed by the future. | |
2677 0.0281 : pub fn unpark(&self) { /* futures::task_impl::Task::unpark::hd7d68e60ad136990 total: 7275 0.0764 */ | |
: self.events.trigger(); | |
1098 0.0115 : self.unpark.unpark(); | |
: } | |
: | |
: /// Returns `true` when called from within the context of the task. In | |
: /// other words, the task is currently running on the thread calling the | |
: /// function. | |
: pub fn is_current(&self) -> bool { | |
: with(|current, _| current.id == self.id) | |
: } | |
:} | |
: | |
:impl fmt::Debug for Task { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: f.debug_struct("Task") | |
: .field("id", &self.id) | |
: .finish() | |
: } | |
:} | |
: | |
:/// For the duration of the given callback, add an "unpark event" to be | |
:/// triggered when the task handle is used to unpark the task. | |
:/// | |
:/// Unpark events are used to pass information about what event caused a task to | |
:/// be unparked. In some cases, tasks are waiting on a large number of possible | |
:/// events, and need precise information about the wakeup to avoid extraneous | |
:/// polling. | |
:/// | |
:/// Every `Task` handle comes with a set of unpark events which will fire when | |
:/// `unpark` is called. When fired, these events insert an identifer into a | |
:/// concurrent set, which the task can read from to determine what events | |
:/// occurred. | |
:/// | |
:/// This function immediately invokes the closure, `f`, but arranges things so | |
:/// that `task::park` will produce a `Task` handle that includes the given | |
:/// unpark event. | |
:/// | |
:/// # Panics | |
:/// | |
:/// This function will panic if a task is not currently being executed. That | |
:/// is, this method can be dangerous to call outside of an implementation of | |
:/// `poll`. | |
:pub fn with_unpark_event<F, R>(event: UnparkEvent, f: F) -> R | |
: where F: FnOnce() -> R | |
:{ | |
: with(|task, data| { | |
: let new_task = Task { | |
: id: task.id, | |
: unpark: task.unpark.clone(), | |
: events: task.events.with_event(event), | |
: }; | |
: set(&new_task, data, f) | |
: }) | |
:} | |
: | |
:#[derive(Clone)] | |
:/// A set insertion to trigger upon `unpark`. | |
:/// | |
:/// Unpark events are used to communicate information about *why* an unpark | |
:/// occured, in particular populating sets with event identifiers so that the | |
:/// unparked task can avoid extraneous polling. See `with_unpark_event` for | |
:/// more. | |
:pub struct UnparkEvent { | |
: set: Arc<EventSet>, | |
: item: usize, | |
:} | |
: | |
:impl UnparkEvent { | |
: /// Construct an unpark event that will insert `id` into `set` when | |
: /// triggered. | |
: pub fn new(set: Arc<EventSet>, id: usize) -> UnparkEvent { | |
: UnparkEvent { | |
: set: set, | |
: item: id, | |
: } | |
: } | |
:} | |
: | |
:/// A concurrent set which allows for the insertion of `usize` values. | |
:/// | |
:/// `EventSet`s are used to communicate precise information about the event(s) | |
:/// that trigged a task notification. See `task::with_unpark_event` for details. | |
:pub trait EventSet: Send + Sync + 'static { | |
: /// Insert the given ID into the set | |
: fn insert(&self, id: usize); | |
:} | |
: | |
:// A collection of UnparkEvents to trigger on `unpark` | |
637 0.0067 :#[derive(Clone)] | |
:enum Events { | |
: Zero, | |
: One(UnparkEvent), | |
: Lots(Vec<UnparkEvent>), | |
:} | |
: | |
:impl Events { | |
283 0.0030 : fn new() -> Events { /* futures::task_impl::Events::new::ha08b13fca5fded1a total: 512 0.0054 */ | |
17 1.8e-04 : Events::Zero | |
212 0.0022 : } | |
: | |
: fn trigger(&self) { | |
: match *self { | |
376 0.0039 : Events::Zero => {} | |
: Events::One(ref event) => event.set.insert(event.item), | |
: Events::Lots(ref list) => { | |
: for event in list { | |
: event.set.insert(event.item); | |
: } | |
: } | |
: } | |
: } | |
: | |
: fn with_event(&self, event: UnparkEvent) -> Events { | |
: let mut list = match *self { | |
: Events::Zero => return Events::One(event), | |
: Events::One(ref event) => vec![event.clone()], | |
: Events::Lots(ref list) => list.clone(), | |
: }; | |
: list.push(event); | |
: Events::Lots(list) | |
: } | |
:} | |
: | |
:/// Representation of a spawned future/stream. | |
:/// | |
:/// This object is returned by the `spawn` function in this module. This | |
:/// represents a "fused task and future", storing all necessary pieces of a task | |
:/// and owning the top-level future that's being driven as well. | |
:/// | |
:/// A `Spawn` can be poll'd for completion or execution of the current thread | |
:/// can be blocked indefinitely until a notification arrives. This can be used | |
:/// with either futures or streams, with different methods being available on | |
:/// `Spawn` depending which is used. | |
:pub struct Spawn<T> { | |
: obj: T, | |
: id: usize, | |
: data: data::LocalMap, | |
:} | |
: | |
:/// Spawns a new future, returning the fused future and task. | |
:/// | |
:/// This function is the termination endpoint for running futures. This method | |
:/// will conceptually allocate a new task to run the given object, which is | |
:/// normally either a `Future` or `Stream`. | |
:/// | |
:/// This function is similar to the `thread::spawn` function but does not | |
:/// attempt to run code in the background. The future will not make progress | |
:/// until the methods on `Spawn` are called in turn. | |
:pub fn spawn<T>(obj: T) -> Spawn<T> { | |
: Spawn { | |
: obj: obj, | |
: id: fresh_task_id(), | |
: data: data::local_map(), | |
: } | |
:} | |
: | |
:impl<T> Spawn<T> { | |
: /// Get a shared reference to the object the Spawn is wrapping. | |
: pub fn get_ref(&self) -> &T { | |
: &self.obj | |
: } | |
: | |
: /// Get a mutable reference to the object the Spawn is wrapping. | |
: pub fn get_mut(&mut self) -> &mut T { | |
: &mut self.obj | |
: } | |
: | |
: /// Consume the Spawn, returning its inner object | |
: pub fn into_inner(self) -> T { | |
: self.obj | |
: } | |
:} | |
: | |
:impl<F: Future> Spawn<F> { | |
: /// Polls the internal future, scheduling notifications to be sent to the | |
: /// `unpark` argument. | |
: /// | |
: /// This method will poll the internal future, testing if it's completed | |
: /// yet. The `unpark` argument is used as a sink for notifications sent to | |
: /// this future. That is, while the future is being polled, any call to | |
: /// `task::park()` will return a handle that contains the `unpark` | |
: /// specified. | |
: /// | |
: /// If this function returns `NotReady`, then the `unpark` should have been | |
: /// scheduled to receive a notification when poll can be called again. | |
: /// Otherwise if `Ready` or `Err` is returned, the `Spawn` task can be | |
: /// safely destroyed. | |
: pub fn poll_future(&mut self, unpark: Arc<Unpark>) -> Poll<F::Item, F::Error> { | |
: self.enter(unpark, |f| f.poll()) | |
: } | |
: | |
: /// Waits for the internal future to complete, blocking this thread's | |
: /// execution until it does. | |
: /// | |
: /// This function will call `poll_future` in a loop, waiting for the future | |
: /// to complete. When a future cannot make progress it will use | |
: /// `thread::park` to block the current thread. | |
: pub fn wait_future(&mut self) -> Result<F::Item, F::Error> { | |
: let unpark = Arc::new(ThreadUnpark::new(thread::current())); | |
: loop { | |
: match try!(self.poll_future(unpark.clone())) { | |
: Async::NotReady => unpark.park(), | |
: Async::Ready(e) => return Ok(e), | |
: } | |
: } | |
: } | |
: | |
: /// A specialized function to request running a future to completion on the | |
: /// specified executor. | |
: /// | |
: /// This function only works for futures whose item and error types are `()` | |
: /// and also implement the `Send` and `'static` bounds. This will submit | |
: /// units of work (instances of `Run`) to the `exec` argument provided | |
: /// necessary to drive the future to completion. | |
: /// | |
: /// When the future would block, it's arranged that when the future is again | |
: /// ready it will submit another unit of work to the `exec` provided. This | |
: /// will happen in a loop until the future has completed. | |
: /// | |
: /// This method is not appropriate for all futures, and other kinds of | |
: /// executors typically provide a similar function with perhaps relaxed | |
: /// bounds as well. | |
: pub fn execute(self, exec: Arc<Executor>) | |
: where F: Future<Item=(), Error=()> + Send + 'static, | |
: { | |
: exec.clone().execute(Run { | |
: // Ideally this method would be defined directly on | |
: // `Spawn<BoxFuture<(), ()>>` so we wouldn't have to box here and | |
: // it'd be more explicit, but unfortunately that currently has a | |
: // link error on nightly: rust-lang/rust#36155 | |
: spawn: Spawn { | |
: id: self.id, | |
: data: self.data, | |
: obj: self.obj.boxed(), | |
: }, | |
: inner: Arc::new(Inner { | |
: exec: exec, | |
: mutex: UnparkMutex::new() | |
: }), | |
: }) | |
: } | |
:} | |
: | |
:impl<S: Stream> Spawn<S> { | |
: /// Like `poll_future`, except polls the underlying stream. | |
: pub fn poll_stream(&mut self, unpark: Arc<Unpark>) | |
: -> Poll<Option<S::Item>, S::Error> { | |
: self.enter(unpark, |stream| stream.poll()) | |
: } | |
: | |
: /// Like `wait_future`, except only waits for the next element to arrive on | |
: /// the underlying stream. | |
: pub fn wait_stream(&mut self) -> Option<Result<S::Item, S::Error>> { | |
: let unpark = Arc::new(ThreadUnpark::new(thread::current())); | |
: loop { | |
: match self.poll_stream(unpark.clone()) { | |
: Ok(Async::NotReady) => unpark.park(), | |
: Ok(Async::Ready(Some(e))) => return Some(Ok(e)), | |
: Ok(Async::Ready(None)) => return None, | |
: Err(e) => return Some(Err(e)), | |
: } | |
: } | |
: } | |
:} | |
: | |
:impl<T> Spawn<T> { | |
: fn enter<F, R>(&mut self, unpark: Arc<Unpark>, f: F) -> R | |
: where F: FnOnce(&mut T) -> R | |
: { | |
3410 0.0358 : let task = Task { | |
71 7.5e-04 : id: self.id, | |
78 8.2e-04 : unpark: unpark, | |
105 0.0011 : events: Events::new(), | |
: }; | |
: let obj = &mut self.obj; | |
13 1.4e-04 : set(&task, &self.data, || f(obj)) | |
9 9.4e-05 : } | |
:} | |
: | |
:/// A trait which represents a sink of notifications that a future is ready to | |
:/// make progress. | |
:/// | |
:/// This trait is provided as an argument to the `Spawn::poll_future` and | |
:/// `Spawn::poll_stream` functions. It's transitively used as part of the | |
:/// `Task::unpark` method to internally deliver notifications of readiness of a | |
:/// future to move forward. | |
:pub trait Unpark: Send + Sync { | |
: /// Indicates that an associated future and/or task are ready to make | |
: /// progress. | |
: /// | |
: /// Typically this means that the receiver of the notification should | |
: /// arrange for the future to get poll'd in a prompt fashion. | |
: fn unpark(&self); | |
:} | |
: | |
:/// A trait representing requests to poll futures. | |
:/// | |
:/// This trait is an argument to the `Spawn::execute` which is used to run a | |
:/// future to completion. An executor will receive requests to run a future and | |
:/// an executor is responsible for ensuring that happens in a timely fashion. | |
:pub trait Executor: Send + Sync + 'static { | |
: /// Requests that `Run` is executed soon on the given executor. | |
: fn execute(&self, r: Run); | |
:} | |
: | |
:struct ThreadUnpark { | |
: thread: thread::Thread, | |
: ready: AtomicBool, | |
:} | |
: | |
:impl ThreadUnpark { | |
: fn new(thread: thread::Thread) -> ThreadUnpark { | |
: ThreadUnpark { | |
: thread: thread, | |
: ready: AtomicBool::new(false), | |
: } | |
: } | |
: | |
: fn park(&self) { | |
: if !self.ready.swap(false, Ordering::SeqCst) { | |
: thread::park(); | |
: } | |
: } | |
:} | |
: | |
:impl Unpark for ThreadUnpark { | |
: fn unpark(&self) { | |
: self.ready.store(true, Ordering::SeqCst); | |
: self.thread.unpark() | |
: } | |
:} | |
: | |
:/// Units of work submitted to an `Executor`, currently only created | |
:/// internally. | |
:pub struct Run { | |
: spawn: Spawn<BoxFuture<(), ()>>, | |
: inner: Arc<Inner>, | |
:} | |
: | |
:struct Inner { | |
: mutex: UnparkMutex<Run>, | |
: exec: Arc<Executor>, | |
:} | |
: | |
:impl Run { | |
: /// Actually run the task (invoking `poll` on its future) on the current | |
: /// thread. | |
: pub fn run(self) { | |
: let Run { mut spawn, inner } = self; | |
: | |
: // SAFETY: the ownership of this `Run` object is evidence that | |
: // we are in the `POLLING`/`REPOLL` state for the mutex. | |
: unsafe { | |
: inner.mutex.start_poll(); | |
: | |
: loop { | |
: match spawn.poll_future(inner.clone()) { | |
: Ok(Async::NotReady) => {} | |
: Ok(Async::Ready(())) | | |
: Err(()) => return inner.mutex.complete(), | |
: } | |
: let run = Run { spawn: spawn, inner: inner.clone() }; | |
: match inner.mutex.wait(run) { | |
: Ok(()) => return, // we've waited | |
: Err(r) => spawn = r.spawn, // someone's notified us | |
: } | |
: } | |
: } | |
: } | |
:} | |
: | |
:impl Unpark for Inner { | |
: fn unpark(&self) { | |
: match self.mutex.notify() { | |
: Ok(run) => self.exec.execute(run), | |
: Err(()) => {} | |
: } | |
: } | |
:} | |
/* | |
* Total samples for file : "/checkout/obj/build/x86_64-unknown-linux-gnu/native/jemalloc/include/jemalloc/internal/jemalloc_internal.h" | |
* | |
* 20909 0.2195 | |
*/ | |
/* je_size2index_compute total: 3 3.1e-05 */ | |
/* je_size2index_compute total: 875 0.0092 */ | |
/* je_size2index_compute total: 207 0.0022 */ | |
/* je_arena_choose.part.25.constprop.29 total: 3 3.1e-05 */ | |
/* je_arena_choose.part.25.constprop.29 total: 414 0.0043 */ | |
/* chunk_purge_default total: 5 5.2e-05 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/string/../sysdeps/x86_64/multiarch/../strcmp.S" | |
* | |
* 20175 0.2118 | |
*/ | |
/* strcmp total: 8334 0.0875 */ | |
/* __GI_strncmp total: 12 1.3e-04 */ | |
/* __strncmp_ssse3 total: 9545 0.1002 */ | |
/* __GI___strcmp_ssse3 total: 2284 0.0240 */ | |
/* | |
* Total samples for file : "Verifier.cpp" | |
* | |
* 20165 0.2117 | |
*/ | |
<credited to line zero> 20165 0.2117 : | |
/* _GLOBAL__sub_I_Verifier.cpp total: 1 1.0e-05 */ | |
/* (anonymous namespace)::Verifier::verifyAttributeCount(llvm::AttributeSet, unsigned int) [clone .isra.4] total: 128 0.0013 */ | |
/* isType(llvm::Metadata const*) total: 15 1.6e-04 */ | |
/* forEachUser(llvm::Value const*, llvm::SmallPtrSet<llvm::Value const*, 32u>&, llvm::function_ref<bool (llvm::Value const*)>) total: 95 1.0e-03 */ | |
/* (anonymous namespace)::Verifier::visitDIScope(llvm::DIScope const&) total: 67 7.0e-04 */ | |
/* (anonymous namespace)::Verifier::visitDITemplateParameter(llvm::DITemplateParameter const&) total: 14 1.5e-04 */ | |
/* (anonymous namespace)::Verifier::visitDIDerivedType(llvm::DIDerivedType const&) total: 91 9.6e-04 */ | |
/* (anonymous namespace)::Verifier::visitDIVariable(llvm::DIVariable const&) total: 136 0.0014 */ | |
/* (anonymous namespace)::Verifier::visitDILocation(llvm::DILocation const&) total: 453 0.0048 */ | |
/* (anonymous namespace)::Verifier::visitTemplateParams(llvm::MDNode const&, llvm::Metadata const&) total: 92 9.7e-04 */ | |
/* (anonymous namespace)::Verifier::verifyCompileUnits() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::Verifier::checkAtomicMemAccessSize(llvm::Module const*, llvm::Type*, llvm::Instruction const*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::Verifier::visitGlobalValue(llvm::GlobalValue const&) [clone .part.799] total: 42 4.4e-04 */ | |
/* (anonymous namespace)::Verifier::visitGlobalValue(llvm::GlobalValue const&) total: 6 6.3e-05 */ | |
/* bool llvm::function_ref<bool (llvm::Value const*)>::callback_fn<(anonymous namespace)::Verifier::visitGlobalValue(llvm::GlobalValue const&)::{lambda(llvm::Value const*)#1}>(long, llvm::Value const*) total: 548 0.0058 */ | |
/* (anonymous namespace)::Verifier::visitValueAsMetadata(llvm::ValueAsMetadata const&, llvm::Function*) total: 239 0.0025 */ | |
/* (anonymous namespace)::Verifier::visitDISubprogram(llvm::DISubprogram const&) total: 166 0.0017 */ | |
/* (anonymous namespace)::Verifier::verifyAttributeTypes(llvm::AttributeSet, unsigned int, bool, llvm::Value const*) total: 413 0.0043 */ | |
/* (anonymous namespace)::Verifier::visitConstantExprsRecursively(llvm::Constant const*) total: 124 0.0013 */ | |
/* (anonymous namespace)::Verifier::visitGlobalVariable(llvm::GlobalVariable const&) total: 20 2.1e-04 */ | |
/* getSubprogram(llvm::Metadata*) total: 334 0.0035 */ | |
/* (anonymous namespace)::Verifier::verifyParameterAttrs(llvm::AttributeSet, unsigned int, llvm::Type*, bool, llvm::Value const*) total: 184 0.0019 */ | |
/* (anonymous namespace)::Verifier::verifyFunctionAttrs(llvm::FunctionType*, llvm::AttributeSet, llvm::Value const*) total: 395 0.0041 */ | |
/* (anonymous namespace)::Verifier::~Verifier() total: 2 2.1e-05 */ | |
/* (anonymous namespace)::Verifier::visitEHPadPredecessors(llvm::Instruction&) total: 31 3.3e-04 */ | |
/* llvm::Pass* llvm::callDefaultCtor<(anonymous namespace)::VerifierLegacyPass>() total: 2 2.1e-05 */ | |
/* (anonymous namespace)::Verifier::visitDILexicalBlockBase(llvm::DILexicalBlockBase const&) total: 57 6.0e-04 */ | |
/* (anonymous namespace)::Verifier::visitMDNode(llvm::MDNode const&) [clone .part.975] total: 1455 0.0153 */ | |
/* (anonymous namespace)::Verifier::visitMDNode(llvm::MDNode const&) total: 737 0.0077 */ | |
/* (anonymous namespace)::Verifier::visitFunction(llvm::Function const&) total: 1800 0.0189 */ | |
/* (anonymous namespace)::Verifier::visitInstruction(llvm::Instruction&) total: 4182 0.0439 */ | |
/* (anonymous namespace)::Verifier::visitTerminatorInst(llvm::TerminatorInst&) total: 59 6.2e-04 */ | |
/* (anonymous namespace)::Verifier::visitReturnInst(llvm::ReturnInst&) total: 23 2.4e-04 */ | |
/* (anonymous namespace)::Verifier::visitBranchInst(llvm::BranchInst&) total: 37 3.9e-04 */ | |
/* (anonymous namespace)::Verifier::visitSwitchInst(llvm::SwitchInst&) total: 39 4.1e-04 */ | |
/* (anonymous namespace)::Verifier::visitBinaryOperator(llvm::BinaryOperator&) total: 30 3.1e-04 */ | |
/* (anonymous namespace)::Verifier::visitLoadInst(llvm::LoadInst&) total: 155 0.0016 */ | |
/* (anonymous namespace)::Verifier::visitGetElementPtrInst(llvm::GetElementPtrInst&) total: 169 0.0018 */ | |
/* (anonymous namespace)::Verifier::visitAtomicCmpXchgInst(llvm::AtomicCmpXchgInst&) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::Verifier::visitTruncInst(llvm::TruncInst&) total: 11 1.2e-04 */ | |
/* (anonymous namespace)::Verifier::visitZExtInst(llvm::ZExtInst&) total: 9 9.4e-05 */ | |
/* (anonymous namespace)::Verifier::visitPtrToIntInst(llvm::PtrToIntInst&) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::Verifier::visitIntToPtrInst(llvm::IntToPtrInst&) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::Verifier::visitBitCastInst(llvm::BitCastInst&) total: 115 0.0012 */ | |
/* (anonymous namespace)::Verifier::visitICmpInst(llvm::ICmpInst&) total: 52 5.5e-04 */ | |
/* (anonymous namespace)::Verifier::visitPHINode(llvm::PHINode&) total: 31 3.3e-04 */ | |
/* (anonymous namespace)::Verifier::visitSelectInst(llvm::SelectInst&) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::Verifier::visitModuleFlags(llvm::Module const&) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::Verifier::verify(llvm::Module const&) total: 17 1.8e-04 */ | |
/* (anonymous namespace)::Verifier::visitBasicBlock(llvm::BasicBlock&) total: 763 0.0080 */ | |
/* (anonymous namespace)::Verifier::verifySiblingFuncletUnwinds() total: 60 6.3e-04 */ | |
/* (anonymous namespace)::Verifier::verifyCallSite(llvm::CallSite) total: 3888 0.0408 */ | |
/* (anonymous namespace)::Verifier::visitInvokeInst(llvm::InvokeInst&) total: 11 1.2e-04 */ | |
/* (anonymous namespace)::Verifier::visitCallInst(llvm::CallInst&) total: 210 0.0022 */ | |
/* (anonymous namespace)::Verifier::verify(llvm::Function const&) total: 2591 0.0272 */ | |
/* (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) total: 50 5.2e-04 */ | |
/* | |
* Total samples for file : "/root/.cargo/git/checkouts/hyper-817b53a166fc1c58/499c0d1/src/http/conn.rs" | |
* | |
* 19236 0.2020 | |
*/ | |
:use std::fmt; | |
:use std::io::{self, Write}; | |
:use std::marker::PhantomData; | |
:use std::time::Instant; | |
: | |
:use futures::{Poll, Async, AsyncSink, Stream, Sink, StartSend}; | |
:use tokio::io::Io; | |
:use tokio_proto::streaming::pipeline::{Frame, Transport}; | |
: | |
:use header::{ContentLength, TransferEncoding}; | |
:use http::{self, Http1Transaction}; | |
:use http::io::{Cursor, Buffered}; | |
:use http::h1::{Encoder, Decoder}; | |
:use version::HttpVersion; | |
: | |
: | |
:/// This handles a connection, which will have been established over an | |
:/// `Io` (like a socket), and will likely include multiple | |
:/// `Transaction`s over HTTP. | |
:/// | |
:/// The connection will determine when a message begins and ends as well as | |
:/// determine if this connection can be kept alive after the message, | |
:/// or if it is complete. | |
:pub struct Conn<I, T, K = KA> { | |
: io: Buffered<I>, | |
: state: State<K>, | |
: _marker: PhantomData<T> | |
:} | |
: | |
:impl<I: Io, T: Http1Transaction, K: KeepAlive> Conn<I, T, K> { | |
: pub fn new(io: I, keep_alive: K) -> Conn<I, T, K> { | |
: Conn { | |
: io: Buffered::new(io), | |
: state: State { | |
: reading: Reading::Init, | |
: writing: Writing::Init, | |
: keep_alive: keep_alive, | |
: }, | |
: _marker: PhantomData, | |
: } | |
: } | |
: | |
: fn parse(&mut self) -> ::Result<Option<http::MessageHead<T::Incoming>>> { | |
: self.io.parse::<T>() | |
: } | |
: | |
: fn is_read_ready(&mut self) -> bool { | |
: match self.state.reading { | |
553 0.0058 : Reading::Init | | |
: Reading::Body(..) => self.io.poll_read().is_ready(), | |
: Reading::KeepAlive | Reading::Closed => true, | |
: } | |
: } | |
: | |
: fn is_read_closed(&self) -> bool { | |
: self.state.is_read_closed() | |
: } | |
: | |
: #[allow(unused)] | |
: fn is_write_closed(&self) -> bool { | |
: self.state.is_write_closed() | |
: } | |
: | |
: fn can_read_head(&self) -> bool { | |
: match self.state.reading { | |
: Reading::Init => true, | |
: _ => false, | |
: } | |
: } | |
: | |
: fn can_read_body(&self) -> bool { | |
: match self.state.reading { | |
: Reading::Body(..) => true, | |
: _ => false, | |
: } | |
: } | |
: | |
: fn read_head(&mut self) -> Poll<Option<Frame<http::MessageHead<T::Incoming>, http::Chunk, ::Error>>, io::Error> { | |
: debug_assert!(self.can_read_head()); | |
: trace!("Conn::read_head"); | |
: | |
2 2.1e-05 : let (version, head) = match self.parse() { | |
23 2.4e-04 : Ok(Some(head)) => (head.version, head), | |
6 6.3e-05 : Ok(None) => return Ok(Async::NotReady), | |
: Err(e) => { | |
: let must_respond_with_error = !self.state.was_idle(); | |
: self.state.close(); | |
: self.io.consume_leading_lines(); | |
: let ret = if !self.io.read_buf().is_empty() { | |
: error!("parse error ({}) with bytes: {:?}", e, self.io.read_buf()); | |
: Ok(Async::Ready(Some(Frame::Error { error: e }))) | |
: } else { | |
: trace!("parse error with 0 input, err = {:?}", e); | |
: if must_respond_with_error { | |
: match e { | |
: ::Error::Io(io) => Err(io), | |
: other => Err(io::Error::new(io::ErrorKind::UnexpectedEof, other)), | |
: } | |
: } else { | |
: debug!("socket complete"); | |
: Ok(Async::Ready(None)) | |
: } | |
: }; | |
: return ret; | |
: } | |
17 1.8e-04 : }; | |
: | |
: match version { | |
4 4.2e-05 : HttpVersion::Http10 | HttpVersion::Http11 => { | |
: let decoder = match T::decoder(&head) { | |
18 1.9e-04 : Ok(d) => d, | |
: Err(e) => { | |
: error!("decoder error = {:?}", e); | |
: self.state.close(); | |
: return Ok(Async::Ready(Some(Frame::Error { error: e }))); | |
: } | |
: }; | |
: self.state.busy(); | |
: let wants_keep_alive = head.should_keep_alive(); | |
1 1.0e-05 : self.state.keep_alive &= wants_keep_alive; | |
4 4.2e-05 : let (body, reading) = if decoder.is_eof() { | |
: (false, Reading::KeepAlive) | |
: } else { | |
14 1.5e-04 : (true, Reading::Body(decoder)) | |
: }; | |
1 1.0e-05 : self.state.reading = reading; | |
2 2.1e-05 : return Ok(Async::Ready(Some(Frame::Message { message: head, body: body }))); | |
: }, | |
: _ => { | |
: error!("unimplemented HTTP Version = {:?}", version); | |
: self.state.close(); | |
: return Ok(Async::Ready(Some(Frame::Error { error: ::Error::Version }))); | |
: } | |
: } | |
: } | |
: | |
: fn read_body(&mut self) -> Poll<Option<http::Chunk>, io::Error> { | |
: debug_assert!(self.can_read_body()); | |
: | |
: trace!("Conn::read_body"); | |
: | |
: let (reading, ret) = match self.state.reading { | |
1398 0.0147 : Reading::Body(ref mut decoder) => { | |
1 1.0e-05 : let slice = try_nb!(decoder.decode(&mut self.io)); | |
415 0.0044 : if !slice.is_empty() { | |
4587 0.0482 : return Ok(Async::Ready(Some(http::Chunk::from(slice)))); | |
: } else { | |
3 3.1e-05 : if decoder.is_eof() { | |
: (Reading::KeepAlive, Ok(Async::Ready(None))) | |
: } else { | |
: (Reading::Closed, Ok(Async::Ready(None))) | |
: } | |
: } | |
: | |
: }, | |
: Reading::Init | Reading::KeepAlive | Reading::Closed => unreachable!() | |
: }; | |
1 1.0e-05 : self.state.reading = reading; | |
: ret | |
: } | |
: | |
: fn can_write_head(&self) -> bool { | |
: match self.state.writing { | |
: Writing::Init => true, | |
: _ => false | |
: } | |
: } | |
: | |
: fn can_write_body(&self) -> bool { | |
: match self.state.writing { | |
: Writing::Body(..) => true, | |
: _ => false | |
: } | |
: } | |
: | |
: fn write_head(&mut self, mut head: http::MessageHead<T::Outgoing>, body: bool) -> StartSend<http::MessageHead<T::Outgoing>,io::Error> { | |
: debug_assert!(self.can_write_head()); | |
: if !body { | |
: head.headers.remove::<TransferEncoding>(); | |
: //TODO: check that this isn't a response to a HEAD | |
: //request, which could include the content-length | |
: //even if no body is to be written | |
3 3.1e-05 : if T::should_set_length(&head) { | |
: head.headers.set(ContentLength(0)); | |
: } | |
: } | |
: | |
: let wants_keep_alive = head.should_keep_alive(); | |
1 1.0e-05 : self.state.keep_alive &= wants_keep_alive; | |
: let mut buf = Vec::new(); | |
: let encoder = T::encode(&mut head, &mut buf); | |
: self.io.buffer(buf); | |
10 1.0e-04 : self.state.writing = if body { | |
: Writing::Body(encoder, None) | |
: } else { | |
: Writing::KeepAlive | |
: }; | |
: | |
: Ok(AsyncSink::Ready) | |
: } | |
: | |
: fn write_body(&mut self, chunk: Option<http::Chunk>) -> StartSend<Option<http::Chunk>, io::Error> { | |
: debug_assert!(self.can_write_body()); | |
: | |
: let state = match self.state.writing { | |
: Writing::Body(ref mut encoder, ref mut queued) => { | |
: if queued.is_some() { | |
: return Ok(AsyncSink::NotReady(chunk)); | |
: } | |
: let mut is_done = true; | |
: let mut wbuf = Cursor::new(match chunk { | |
: Some(chunk) => { | |
: is_done = false; | |
: chunk | |
: } | |
: None => { | |
: // Encode a zero length chunk | |
: // the http1 encoder does the right thing | |
: // encoding either the final chunk or ignoring the input | |
: http::Chunk::from(Vec::new()) | |
: } | |
: }); | |
: | |
: match encoder.encode(&mut self.io, wbuf.buf()) { | |
: Ok(n) => { | |
: wbuf.consume(n); | |
: | |
: if !wbuf.is_written() { | |
: trace!("Conn::start_send frame not written, queued"); | |
: *queued = Some(wbuf); | |
: } | |
: }, | |
: Err(e) => match e.kind() { | |
: io::ErrorKind::WouldBlock => { | |
: trace!("Conn::start_send frame not written, queued"); | |
: *queued = Some(wbuf); | |
: }, | |
: _ => return Err(e) | |
: } | |
: } | |
: | |
: if encoder.is_eof() { | |
: Writing::KeepAlive | |
: } else if is_done { | |
: Writing::Closed | |
: } else { | |
: return Ok(AsyncSink::Ready); | |
: } | |
: }, | |
: Writing::Init | Writing::KeepAlive | Writing::Closed => unreachable!(), | |
: }; | |
: self.state.writing = state; | |
: Ok(AsyncSink::Ready) | |
: } | |
: | |
: fn write_queued(&mut self) -> Poll<(), io::Error> { | |
: trace!("Conn::write_queued()"); | |
: match self.state.writing { | |
3331 0.0350 : Writing::Body(ref mut encoder, ref mut queued) => { | |
: let complete = if let Some(chunk) = queued.as_mut() { | |
: let n = try_nb!(encoder.encode(&mut self.io, chunk.buf())); | |
: chunk.consume(n); | |
: chunk.is_written() | |
: } else { | |
: true | |
: }; | |
: trace!("Conn::write_queued complete = {}", complete); | |
: if complete { | |
: *queued = None; | |
: Ok(Async::Ready(())) | |
: } else { | |
: Ok(Async::NotReady) | |
: } | |
: }, | |
: _ => Ok(Async::Ready(())), | |
: } | |
: } | |
: | |
: fn flush(&mut self) -> Poll<(), io::Error> { | |
: let ret = try!(self.write_queued()); | |
: try_nb!(self.io.flush()); | |
433 0.0045 : self.state.try_keep_alive(); | |
: trace!("flushed {:?}", self.state); | |
289 0.0030 : if self.is_read_ready() { | |
88 9.2e-04 : ::futures::task::park().unpark(); | |
: } | |
207 0.0022 : Ok(ret) | |
: | |
: } | |
:} | |
: | |
:impl<I, T, K> Stream for Conn<I, T, K> | |
:where I: Io, | |
: T: Http1Transaction, | |
: K: KeepAlive, | |
: T::Outgoing: fmt::Debug { | |
: type Item = Frame<http::MessageHead<T::Incoming>, http::Chunk, ::Error>; | |
: type Error = io::Error; | |
: | |
1950 0.0205 : fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> { /* _$LT$hyper..http..conn..Conn$LT$I$C$$u20$T$C$$u20$K$GT$$u20$as$u20$futures..stream..Stream$GT$::poll::hfc2ccef3c91d91de total: 33298 0.3496 */ | |
: trace!("Conn::poll()"); | |
: | |
1316 0.0138 : if self.is_read_closed() { | |
: trace!("Conn::poll when closed"); | |
: Ok(Async::Ready(None)) | |
: } else if self.can_read_head() { | |
: self.read_head() | |
: } else if self.can_read_body() { | |
: self.read_body() | |
: .map(|async| async.map(|chunk| Some(Frame::Body { | |
: chunk: chunk | |
: }))) | |
: } else { | |
: trace!("poll when on keep-alive"); | |
7 7.3e-05 : Ok(Async::NotReady) | |
: } | |
1780 0.0187 : } | |
:} | |
: | |
:impl<I, T, K> Sink for Conn<I, T, K> | |
:where I: Io, | |
: T: Http1Transaction, | |
: K: KeepAlive, | |
: T::Outgoing: fmt::Debug { | |
: type SinkItem = Frame<http::MessageHead<T::Outgoing>, http::Chunk, ::Error>; | |
: type SinkError = io::Error; | |
: | |
11 1.2e-04 : fn start_send(&mut self, frame: Self::SinkItem) -> StartSend<Self::SinkItem, Self::SinkError> { | |
: trace!("Conn::start_send( frame={:?} )", DebugFrame(&frame)); | |
: | |
: let frame: Self::SinkItem = match frame { | |
2 2.1e-05 : Frame::Message { message: head, body } => { | |
: if self.can_write_head() { | |
10 1.0e-04 : return self.write_head(head, body) | |
: .map(|async| { | |
: match async { | |
: AsyncSink::Ready => AsyncSink::Ready, | |
: AsyncSink::NotReady(head) => { | |
: AsyncSink::NotReady(Frame::Message { | |
: message: head, | |
: body: body, | |
: }) | |
: } | |
: } | |
: }) | |
: } else { | |
: Frame::Message { message: head, body: body } | |
: } | |
: }, | |
: Frame::Body { chunk } => { | |
: if self.can_write_body() { | |
: return self.write_body(chunk) | |
: .map(|async| { | |
: match async { | |
: AsyncSink::Ready => AsyncSink::Ready, | |
: AsyncSink::NotReady(chunk) => AsyncSink::NotReady(Frame::Body { | |
: chunk: chunk, | |
: }) | |
: } | |
: }); | |
: } else if chunk.is_none() { | |
: return Ok(AsyncSink::Ready); | |
: } else { | |
: Frame::Body { chunk: chunk } | |
: } | |
: }, | |
: Frame::Error { error } => { | |
: debug!("received error, closing: {:?}", error); | |
: self.state.close(); | |
: return Ok(AsyncSink::Ready); | |
: }, | |
: }; | |
: | |
: error!("writing illegal frame; state={:?}, frame={:?}", self.state.writing, frame); | |
: Err(io::Error::new(io::ErrorKind::InvalidInput, "illegal frame")) | |
: | |
8 8.4e-05 : } | |
: | |
: fn poll_complete(&mut self) -> Poll<(), Self::SinkError> { | |
: trace!("Conn::poll_complete()"); | |
: let ret = self.flush(); | |
: trace!("Conn::flush = {:?}", ret); | |
2191 0.0230 : ret | |
: } | |
:} | |
: | |
:impl<I, T, K> Transport for Conn<I, T, K> | |
:where I: Io + 'static, | |
: T: Http1Transaction + 'static, | |
: K: KeepAlive + 'static, | |
: T::Outgoing: fmt::Debug {} | |
: | |
:impl<I, T, K: fmt::Debug> fmt::Debug for Conn<I, T, K> { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: f.debug_struct("Conn") | |
: .field("state", &self.state) | |
: .field("io", &self.io) | |
: .finish() | |
: } | |
:} | |
: | |
:#[derive(Debug)] | |
:struct State<K> { | |
: reading: Reading, | |
: writing: Writing, | |
: keep_alive: K, | |
:} | |
: | |
:#[derive(Debug)] | |
:enum Reading { | |
: Init, | |
: Body(Decoder), | |
: KeepAlive, | |
: Closed, | |
:} | |
: | |
:#[derive(Debug)] | |
:enum Writing { | |
: Init, | |
: Body(Encoder, Option<Cursor<http::Chunk>>), | |
: KeepAlive, | |
: Closed, | |
:} | |
: | |
:impl ::std::ops::BitAndAssign<bool> for KA { | |
13 1.4e-04 : fn bitand_assign(&mut self, enabled: bool) { /* _$LT$hyper..http..conn..KA$u20$as$u20$core..ops..BitAndAssign$LT$bool$GT$$GT$::bitand_assign::hec2059fdf60a69c5 total: 15 1.6e-04 */ | |
: if !enabled { | |
: *self = KA::Disabled; | |
: } | |
2 2.1e-05 : } | |
:} | |
: | |
:pub trait KeepAlive: fmt::Debug + ::std::ops::BitAndAssign<bool> { | |
: fn busy(&mut self); | |
: fn disable(&mut self); | |
: fn idle(&mut self); | |
: fn status(&self) -> KA; | |
:} | |
: | |
:#[derive(Clone, Copy, Debug)] | |
:pub enum KA { | |
: Idle(Instant), | |
: Busy, | |
: Disabled, | |
:} | |
: | |
:impl Default for KA { | |
: fn default() -> KA { | |
: KA::Busy | |
: } | |
:} | |
: | |
:impl KeepAlive for KA { | |
: fn idle(&mut self) { | |
: *self = KA::Idle(Instant::now()); | |
: } | |
: | |
3 3.1e-05 : fn busy(&mut self) { /* _$LT$hyper..http..conn..KA$u20$as$u20$hyper..http..conn..KeepAlive$GT$::busy::h1c9c717126541b30 total: 3 3.1e-05 */ | |
: *self = KA::Busy; | |
: } | |
: | |
: fn disable(&mut self) { | |
: *self = KA::Disabled; | |
: } | |
: | |
4 4.2e-05 : fn status(&self) -> KA { /* _$LT$hyper..http..conn..KA$u20$as$u20$hyper..http..conn..KeepAlive$GT$::status::h7487586cc965fa96 total: 7 7.3e-05 */ | |
2 2.1e-05 : *self | |
1 1.0e-05 : } | |
:} | |
: | |
:impl<K: KeepAlive> State<K> { | |
: fn close(&mut self) { | |
: trace!("State::close()"); | |
: self.reading = Reading::Closed; | |
: self.writing = Writing::Closed; | |
: self.keep_alive.disable(); | |
: } | |
: | |
: fn try_keep_alive(&mut self) { | |
: match (&self.reading, &self.writing) { | |
501 0.0053 : (&Reading::KeepAlive, &Writing::KeepAlive) => { | |
3 3.1e-05 : if let KA::Busy = self.keep_alive.status() { | |
: self.reading = Reading::Init; | |
20 2.1e-04 : self.writing = Writing::Init; | |
: self.keep_alive.idle(); | |
: } else { | |
: self.close(); | |
: } | |
: }, | |
: (&Reading::Closed, &Writing::KeepAlive) | | |
: (&Reading::KeepAlive, &Writing::Closed) => { | |
: self.close() | |
: } | |
: _ => () | |
: } | |
: } | |
: | |
: fn was_idle(&self) -> bool { | |
: if let KA::Idle(..) = self.keep_alive.status() { | |
: true | |
: } else { | |
: false | |
: } | |
: } | |
: | |
: fn busy(&mut self) { | |
: self.keep_alive.busy(); | |
: } | |
: | |
: fn is_read_closed(&self) -> bool { | |
: match self.reading { | |
: Reading::Closed => true, | |
: _ => false | |
: } | |
: } | |
: | |
: #[allow(unused)] | |
: fn is_write_closed(&self) -> bool { | |
: match self.writing { | |
: Writing::Closed => true, | |
: _ => false | |
: } | |
: } | |
:} | |
: | |
:// The DebugFrame and DebugChunk are simple Debug implementations that allow | |
:// us to dump the frame into logs, without logging the entirety of the bytes. | |
:struct DebugFrame<'a, T: fmt::Debug + 'a>(&'a Frame<http::MessageHead<T>, http::Chunk, ::Error>); | |
: | |
:impl<'a, T: fmt::Debug + 'a> fmt::Debug for DebugFrame<'a, T> { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: match *self.0 { | |
: Frame::Message { ref message, ref body } => { | |
: f.debug_struct("Message") | |
: .field("message", message) | |
: .field("body", body) | |
: .finish() | |
: }, | |
: Frame::Body { chunk: Some(ref chunk) } => { | |
: f.debug_struct("Body") | |
: .field("chunk", &DebugChunk(chunk)) | |
: .finish() | |
: }, | |
: Frame::Body { chunk: None } => { | |
: f.debug_struct("Body") | |
: .field("chunk", &None::<()>) | |
: .finish() | |
: }, | |
: Frame::Error { ref error } => { | |
: f.debug_struct("Error") | |
: .field("error", error) | |
: .finish() | |
: } | |
: } | |
: } | |
:} | |
: | |
:struct DebugChunk<'a>(&'a http::Chunk); | |
: | |
:impl<'a> fmt::Debug for DebugChunk<'a> { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: f.debug_tuple("Chunk") | |
: .field(&self.0.len()) | |
: .finish() | |
: } | |
:} | |
: | |
:#[cfg(test)] | |
:mod tests { | |
: use futures::{Async, Stream, Sink}; | |
: use tokio_proto::streaming::pipeline::Frame; | |
: | |
: use http::{MessageHead, ServerTransaction}; | |
: use http::h1::Encoder; | |
: use mock::AsyncIo; | |
: | |
: use super::{Conn, Writing}; | |
: use ::uri::Uri; | |
: | |
: use std::str::FromStr; | |
: | |
: #[test] | |
: fn test_conn_init_read() { | |
: let good_message = b"GET / HTTP/1.1\r\n\r\n".to_vec(); | |
: let len = good_message.len(); | |
: let io = AsyncIo::new_buf(good_message, len); | |
: let mut conn = Conn::<_, ServerTransaction>::new(io, Default::default()); | |
: | |
: match conn.poll().unwrap() { | |
: Async::Ready(Some(Frame::Message { message, body: false })) => { | |
: assert_eq!(message, MessageHead { | |
: subject: ::http::RequestLine(::Get, Uri::from_str("/").unwrap()), | |
: .. MessageHead::default() | |
: }) | |
: }, | |
: f => panic!("frame is not Frame::Message: {:?}", f) | |
: } | |
: } | |
: | |
: #[test] | |
: fn test_conn_parse_partial() { | |
: let good_message = b"GET / HTTP/1.1\r\nHost: foo.bar\r\n\r\n".to_vec(); | |
: let io = AsyncIo::new_buf(good_message, 10); | |
: let mut conn = Conn::<_, ServerTransaction>::new(io, Default::default()); | |
: assert!(conn.poll().unwrap().is_not_ready()); | |
: conn.io.io_mut().block_in(50); | |
: let async = conn.poll().unwrap(); | |
: assert!(async.is_ready()); | |
: match async { | |
: Async::Ready(Some(Frame::Message { .. })) => (), | |
: f => panic!("frame is not Message: {:?}", f), | |
: } | |
: } | |
: | |
: #[test] | |
: fn test_conn_closed_read() { | |
: let io = AsyncIo::new_buf(vec![], 0); | |
: let mut conn = Conn::<_, ServerTransaction>::new(io, Default::default()); | |
: conn.state.close(); | |
: | |
: match conn.poll().unwrap() { | |
: Async::Ready(None) => {}, | |
: other => panic!("frame is not None: {:?}", other) | |
: } | |
: } | |
: | |
: #[test] | |
: fn test_conn_body_write_length() { | |
: extern crate pretty_env_logger; | |
: use ::futures::Future; | |
: let _ = pretty_env_logger::init(); | |
: let _: Result<(), ()> = ::futures::lazy(|| { | |
: let io = AsyncIo::new_buf(vec![], 0); | |
: let mut conn = Conn::<_, ServerTransaction>::new(io, Default::default()); | |
: let max = ::http::io::MAX_BUFFER_SIZE + 4096; | |
: conn.state.writing = Writing::Body(Encoder::length((max * 2) as u64), None); | |
: | |
: assert!(conn.start_send(Frame::Body { chunk: Some(vec![b'a'; 1024 * 4].into()) }).unwrap().is_ready()); | |
: match conn.state.writing { | |
: Writing::Body(_, None) => {}, | |
: _ => panic!("writing did not queue chunk: {:?}", conn.state.writing), | |
: } | |
: | |
: assert!(conn.start_send(Frame::Body { chunk: Some(vec![b'b'; max].into()) }).unwrap().is_ready()); | |
: | |
: match conn.state.writing { | |
: Writing::Body(_, Some(_)) => {}, | |
: _ => panic!("writing did not queue chunk: {:?}", conn.state.writing), | |
: } | |
: | |
: assert!(conn.start_send(Frame::Body { chunk: Some(vec![b'b'; 1024 * 4].into()) }).unwrap().is_not_ready()); | |
: | |
: conn.io.io_mut().block_in(1024 * 3); | |
: assert!(conn.poll_complete().unwrap().is_not_ready()); | |
: conn.io.io_mut().block_in(1024 * 3); | |
: assert!(conn.poll_complete().unwrap().is_not_ready()); | |
: conn.io.io_mut().block_in(max * 2); | |
: assert!(conn.poll_complete().unwrap().is_not_ready()); | |
: assert!(conn.poll_complete().unwrap().is_ready()); | |
: | |
: assert!(conn.start_send(Frame::Body { chunk: Some(vec![b'c'; 1024 * 4].into()) }).unwrap().is_ready()); | |
: Ok(()) | |
: }).wait(); | |
: } | |
: | |
: #[test] | |
: fn test_conn_body_write_chunked() { | |
: use ::futures::Future; | |
: let _: Result<(), ()> = ::futures::lazy(|| { | |
: let io = AsyncIo::new_buf(vec![], 4096); | |
: let mut conn = Conn::<_, ServerTransaction>::new(io, Default::default()); | |
: conn.state.writing = Writing::Body(Encoder::chunked(), None); | |
: | |
: assert!(conn.start_send(Frame::Body { chunk: Some("headers".into()) }).unwrap().is_ready()); | |
: assert!(conn.start_send(Frame::Body { chunk: Some(vec![b'x'; 4096].into()) }).unwrap().is_ready()); | |
: Ok(()) | |
: }).wait(); | |
: } | |
: #[test] | |
: fn test_conn_closed_write() { | |
: let io = AsyncIo::new_buf(vec![], 0); | |
: let mut conn = Conn::<_, ServerTransaction>::new(io, Default::default()); | |
: conn.state.close(); | |
: | |
: match conn.start_send(Frame::Body { chunk: Some(b"foobar".to_vec().into()) }) { | |
: Err(_e) => {}, | |
: other => panic!("did not return Err: {:?}", other) | |
: } | |
: | |
: assert!(conn.state.is_write_closed()); | |
: } | |
:} | |
/* | |
* Total samples for file : "InstructionSimplify.cpp" | |
* | |
* 18840 0.1978 | |
*/ | |
<credited to line zero> 18840 0.1978 : | |
/* computePointerICmp(llvm::DataLayout const&, llvm::TargetLibraryInfo const*, llvm::DominatorTree const*, llvm::CmpInst::Predicate, llvm::Instruction const*, llvm::Value*, llvm::Value*)::{lambda(llvm::SmallVectorImpl<llvm::Value*>&)#2}::operator()(llvm::SmallVectorImpl<llvm::Value*>&) const::{lambda(llvm::Value*)#1}::operator()(llvm::Value*) const [clone .isra.328] total: 14 1.5e-04 */ | |
/* computePointerICmp(llvm::DataLayout const&, llvm::TargetLibraryInfo const*, llvm::DominatorTree const*, llvm::CmpInst::Predicate, llvm::Instruction const*, llvm::Value*, llvm::Value*)::{lambda(llvm::SmallVectorImpl<llvm::Value*>&)#2}::operator()(llvm::SmallVectorImpl<llvm::Value*>&) const [clone .isra.331] total: 15 1.6e-04 */ | |
/* computePointerICmp(llvm::DataLayout const&, llvm::TargetLibraryInfo const*, llvm::DominatorTree const*, llvm::CmpInst::Predicate, llvm::Instruction const*, llvm::Value*, llvm::Value*) total: 605 0.0064 */ | |
/* getFalse(llvm::Type*) total: 2 2.1e-05 */ | |
/* llvm::User::getOperand(unsigned int) const [clone .constprop.542] total: 321 0.0034 */ | |
/* bool llvm::PatternMatch::match<llvm::Value, llvm::PatternMatch::class_match<llvm::UndefValue> >(llvm::Value*, llvm::PatternMatch::class_match<llvm::UndefValue> const&) [clone .isra.301] total: 54 5.7e-04 */ | |
/* llvm::BinaryOperator::getOperand(unsigned int) const [clone .constprop.538] total: 4 4.2e-05 */ | |
/* llvm::BinaryOperator::getOperand(unsigned int) const [clone .constprop.537] total: 15 1.6e-04 */ | |
/* bool llvm::PatternMatch::match_zero::match<llvm::Value>(llvm::Value*) [clone .isra.213] total: 825 0.0087 */ | |
/* bool llvm::PatternMatch::cst_pred_ty<llvm::PatternMatch::is_all_ones>::match<llvm::Value>(llvm::Value*) [clone .isra.416] total: 208 0.0022 */ | |
/* SimplifyFDivInst(llvm::Value*, llvm::Value*, llvm::FastMathFlags, (anonymous namespace)::Query const&, unsigned int) [clone .isra.302] total: 1 1.0e-05 */ | |
/* SimplifyRightShift(unsigned int, llvm::Value*, llvm::Value*, bool, (anonymous namespace)::Query const&, unsigned int) [clone .part.513] total: 3 3.1e-05 */ | |
/* ValueDominatesPHI(llvm::Value*, llvm::PHINode*, llvm::DominatorTree const*) total: 299 0.0031 */ | |
/* isUndefShift(llvm::Value*) total: 160 0.0017 */ | |
/* isSameCompare(llvm::Value*, llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*) total: 11 1.2e-04 */ | |
/* SimplifyFMulInst(llvm::Value*, llvm::Value*, llvm::FastMathFlags, (anonymous namespace)::Query const&, unsigned int) [clone .isra.479] total: 2 2.1e-05 */ | |
/* simplifyUnsignedRangeCheck(llvm::ICmpInst*, llvm::ICmpInst*, bool) total: 51 5.4e-04 */ | |
/* bool llvm::PatternMatch::cst_pred_ty<llvm::PatternMatch::is_one>::match<llvm::Value>(llvm::Value*) [clone .isra.413] total: 28 2.9e-04 */ | |
/* SimplifyLShrInst(llvm::Value*, llvm::Value*, bool, (anonymous namespace)::Query const&, unsigned int) [clone .part.514] total: 45 4.7e-04 */ | |
/* SimplifyShlInst(llvm::Value*, llvm::Value*, bool, bool, (anonymous namespace)::Query const&, unsigned int) [clone .part.512] total: 118 0.0012 */ | |
/* SimplifyAndOfICmps(llvm::ICmpInst*, llvm::ICmpInst*) total: 61 6.4e-04 */ | |
/* SimplifyOrOfICmps(llvm::ICmpInst*, llvm::ICmpInst*) total: 28 2.9e-04 */ | |
/* stripAndComputeConstantOffsets(llvm::DataLayout const&, llvm::Value*&, bool) total: 948 0.0100 */ | |
/* SimplifyOrInst(llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 531 0.0056 */ | |
/* SimplifyBinOp(unsigned int, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 382 0.0040 */ | |
/* SimplifyAssociativeBinOp(unsigned int, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 681 0.0072 */ | |
/* SimplifyXorInst(llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 35 3.7e-04 */ | |
/* SimplifyAddInst(llvm::Value*, llvm::Value*, bool, bool, (anonymous namespace)::Query const&, unsigned int) [clone .isra.509] total: 309 0.0032 */ | |
/* SimplifySubInst(llvm::Value*, llvm::Value*, bool, bool, (anonymous namespace)::Query const&, unsigned int) [clone .isra.510] total: 268 0.0028 */ | |
/* ExpandBinOp(unsigned int, llvm::Value*, llvm::Value*, unsigned int, (anonymous namespace)::Query const&, unsigned int) total: 397 0.0042 */ | |
/* ThreadBinOpOverSelect(unsigned int, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 17 1.8e-04 */ | |
/* ThreadBinOpOverPHI(unsigned int, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 227 0.0024 */ | |
/* SimplifyAndInst(llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 552 0.0058 */ | |
/* SimplifyMulInst(llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 75 7.9e-04 */ | |
/* SimplifyDiv(llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 8 8.4e-05 */ | |
/* SimplifyRem(llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 8 8.4e-05 */ | |
/* SimplifyShift(unsigned int, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 421 0.0044 */ | |
/* SimplifyICmpInst(unsigned int, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 10718 0.1125 */ | |
/* ThreadCmpOverSelect(llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 20 2.1e-04 */ | |
/* SimplifyFCmpInst(unsigned int, llvm::Value*, llvm::Value*, llvm::FastMathFlags, (anonymous namespace)::Query const&, unsigned int) total: 3 3.1e-05 */ | |
/* ThreadCmpOverPHI(llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) total: 273 0.0029 */ | |
/* SimplifyWithOpReplaced(llvm::Value*, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) [clone .constprop.532] total: 97 0.0010 */ | |
/* | |
* Total samples for file : "/home/stb/data-rs/http-server/<try macros>" | |
* | |
* 16485 0.1731 | |
*/ | |
/* | |
* Total samples for file : "/checkout/src/liballoc_jemalloc/../jemalloc/src/arena.c" | |
* | |
* 16385 0.1720 | |
*/ | |
/* arena_run_tree_remove total: 1 1.0e-05 */ | |
/* arena_run_tree_insert total: 1847 0.0194 */ | |
/* arena_run_tree_remove total: 1904 0.0200 */ | |
/* run_quantize_floor_compute total: 6 6.3e-05 */ | |
/* arena_run_first_best_fit total: 2 2.1e-05 */ | |
/* arena_run_first_best_fit total: 538 0.0056 */ | |
/* arena_avail_insert.isra.23 total: 2 2.1e-05 */ | |
/* arena_avail_insert.isra.23 total: 221 0.0023 */ | |
/* arena_avail_remove.isra.24 total: 2 2.1e-05 */ | |
/* arena_avail_remove.isra.24 total: 249 0.0026 */ | |
/* arena_nactive_add.isra.28 total: 46 4.8e-04 */ | |
/* arena_nactive_sub.isra.29 total: 1 1.0e-05 */ | |
/* arena_nactive_sub.isra.29 total: 53 5.6e-04 */ | |
/* arena_run_split_remove total: 1 1.0e-05 */ | |
/* arena_run_split_remove total: 173 0.0018 */ | |
/* arena_run_split_large_helper total: 1 1.0e-05 */ | |
/* arena_run_split_large_helper total: 74 7.8e-04 */ | |
/* arena_run_split_small total: 199 0.0021 */ | |
/* arena_chunk_alloc total: 4 4.2e-05 */ | |
/* arena_chunk_alloc total: 5 5.2e-05 */ | |
/* arena_huge_malloc_stats_update total: 1 1.0e-05 */ | |
/* arena_run_alloc_large_helper total: 41 4.3e-04 */ | |
/* arena_run_alloc_large total: 17 1.8e-04 */ | |
/* arena_run_alloc_small_helper total: 1 1.0e-05 */ | |
/* arena_run_alloc_small_helper total: 76 8.0e-04 */ | |
/* je_arena_maybe_purge total: 1 1.0e-05 */ | |
/* je_arena_maybe_purge total: 83 8.7e-04 */ | |
/* arena_purge_to_limit total: 127 0.0013 */ | |
/* je_arena_purge total: 10 1.0e-04 */ | |
/* arena_run_dalloc total: 2 2.1e-05 */ | |
/* arena_run_dalloc total: 339 0.0036 */ | |
/* arena_bin_nonfull_run_tryget total: 807 0.0085 */ | |
/* arena_bin_malloc_hard total: 3 3.1e-05 */ | |
/* arena_bin_malloc_hard total: 486 0.0051 */ | |
/* je_arena_tcache_fill_small total: 89 9.3e-04 */ | |
/* je_arena_tcache_fill_small total: 4974 0.0522 */ | |
/* je_arena_quarantine_junk_small total: 49 5.1e-04 */ | |
/* je_arena_malloc_hard total: 34 3.6e-04 */ | |
/* je_arena_palloc total: 2 2.1e-05 */ | |
/* arena_dalloc_bin_run.isra.40 total: 42 4.4e-04 */ | |
/* arena_bin_lower_run.isra.32 total: 109 0.0011 */ | |
/* arena_dalloc_bin_locked_impl.isra.41 total: 180 0.0019 */ | |
/* arena_dalloc_bin_locked_impl.isra.41 total: 7249 0.0761 */ | |
/* je_arena_prof_promoted total: 45 4.7e-04 */ | |
/* arena_dalloc_large_locked_impl.isra.43 total: 60 6.3e-04 */ | |
/* je_arena_dalloc_large_junked_locked total: 1 1.0e-05 */ | |
/* je_arena_dalloc_large total: 12 1.3e-04 */ | |
/* je_arena_ralloc_no_move total: 2 2.1e-05 */ | |
/* je_arena_ralloc_no_move total: 177 0.0019 */ | |
/* je_arena_ralloc_no_move total: 2796 0.0294 */ | |
/* je_arena_ralloc total: 167 0.0018 */ | |
/* je_arena_ralloc total: 4530 0.0476 */ | |
/* je_arena_new total: 2 2.1e-05 */ | |
/* bin_info_run_size_calc total: 5 5.2e-05 */ | |
/* je_arena_boot total: 4 4.2e-05 */ | |
/* | |
* Total samples for file : "InlineCost.cpp" | |
* | |
* 14705 0.1544 | |
*/ | |
<credited to line zero> 14705 0.1544 : | |
/* (anonymous namespace)::CallAnalyzer::accumulateSROACost(llvm::DenseMapIterator<llvm::Value*, int, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, int>, false>, int) [clone .isra.71] [clone .constprop.352] total: 39 4.1e-04 */ | |
/* (anonymous namespace)::CallAnalyzer::~CallAnalyzer() total: 30 3.1e-04 */ | |
/* (anonymous namespace)::CallAnalyzer::CallAnalyzer(llvm::TargetTransformInfo const&, llvm::AssumptionCacheTracker*, llvm::ProfileSummaryInfo*, llvm::Function&, int, llvm::CallSite) total: 123 0.0013 */ | |
/* (anonymous namespace)::CallAnalyzer::lookupSROAArgAndCost(llvm::Value*, llvm::Value*&, llvm::DenseMapIterator<llvm::Value*, int, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, int>, false>&) total: 776 0.0081 */ | |
/* (anonymous namespace)::CallAnalyzer::disableSROA(llvm::Value*) total: 119 0.0012 */ | |
/* (anonymous namespace)::CallAnalyzer::visitInstruction(llvm::Instruction&) total: 323 0.0034 */ | |
/* llvm::InstVisitor<(anonymous namespace)::CallAnalyzer, bool>::visitCallSite(llvm::CallSite) total: 9 9.4e-05 */ | |
/* (anonymous namespace)::CallAnalyzer::accumulateGEPOffset(llvm::GEPOperator&, llvm::APInt&) total: 648 0.0068 */ | |
/* (anonymous namespace)::CallAnalyzer::visitGetElementPtr(llvm::GetElementPtrInst&) total: 588 0.0062 */ | |
/* (anonymous namespace)::CallAnalyzer::visitBinaryOperator(llvm::BinaryOperator&) total: 210 0.0022 */ | |
/* (anonymous namespace)::CallAnalyzer::visitUnaryInstruction(llvm::UnaryInstruction&) total: 130 0.0014 */ | |
/* (anonymous namespace)::CallAnalyzer::visitCastInst(llvm::CastInst&) total: 25 2.6e-04 */ | |
/* (anonymous namespace)::CallAnalyzer::visitCmpInst(llvm::CmpInst&) total: 443 0.0047 */ | |
/* (anonymous namespace)::CallAnalyzer::analyzeCall(llvm::CallSite) total: 2101 0.0221 */ | |
/* (anonymous namespace)::CallAnalyzer::visitCallSite(llvm::CallSite) total: 384 0.0040 */ | |
/* (anonymous namespace)::CallAnalyzer::analyzeBlock(llvm::BasicBlock*, llvm::SmallPtrSetImpl<llvm::Value const*>&) total: 8757 0.0919 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/nptl/../sysdeps/unix/sysv/linux/x86_64/recv.c" | |
* | |
* 14093 0.1480 | |
*/ | |
/* recv total: 14093 0.1480 */ | |
/* | |
* Total samples for file : "/checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/tsd.h" | |
* | |
* 12613 0.1324 | |
*/ | |
/* je_arena_choose.part.36 total: 15 1.6e-04 */ | |
/* | |
* Total samples for file : "SROA.cpp" | |
* | |
* 12393 0.1301 | |
*/ | |
<credited to line zero> 12393 0.1301 : | |
/* __gnu_cxx::__exchange_and_add_dispatch(int*, int) [clone .constprop.1065] total: 396 0.0042 */ | |
/* llvm::SmallDenseMap<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, 8u, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >::getInlineBuckets() const total: 95 1.0e-03 */ | |
/* (anonymous namespace)::Slice** std::remove_if<(anonymous namespace)::Slice**, llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#1}>(llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#1}, llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#1}, llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#1}) total: 58 6.1e-04 */ | |
/* bool std::any_of<(anonymous namespace)::Slice**, llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#2}>((anonymous namespace)::Slice**, llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#2}, llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#2}) total: 25 2.6e-04 */ | |
/* bool std::all_of<(anonymous namespace)::Slice**, llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#3}>((anonymous namespace)::Slice**, llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#3}, llvm::sroa::AllocaSlices::partition_iterator::advance()::{lambda((anonymous namespace)::Slice*)#3}) total: 23 2.4e-04 */ | |
/* llvm::SmallVectorImpl<(anonymous namespace)::Slice>::erase((anonymous namespace)::Slice const*, (anonymous namespace)::Slice const*) total: 117 0.0012 */ | |
/* llvm::SmallDenseMap<llvm::Instruction*, unsigned int, 4u, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, unsigned int> >::allocateBuckets(unsigned int) [clone .isra.427] total: 1 1.0e-05 */ | |
/* llvm::DenseMapIterator<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets>, false>::DenseMapIterator(llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets>*, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets>*, llvm::DebugEpochBase const&, bool) [clone .constprop.1007] total: 8 8.4e-05 */ | |
/* llvm::sroa::AllocaSliceRewriter::getSliceAlign(llvm::Type*) [clone .constprop.1018] total: 1 1.0e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::Slice*, true>::grow(unsigned long) total: 2 2.1e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::Slice, true>::grow(unsigned long) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::Slice::makeUnsplittable() total: 14 1.5e-04 */ | |
/* void std::__insertion_sort<(anonymous namespace)::Slice*>((anonymous namespace)::Slice*, (anonymous namespace)::Slice*) total: 449 0.0047 */ | |
/* (anonymous namespace)::IRBuilderPrefixedInserter::SetNamePrefix(llvm::Twine const&) total: 430 0.0045 */ | |
/* llvm::Statistic::operator+=(unsigned int) [clone .part.266] total: 235 0.0025 */ | |
/* llvm::SmallDenseMap<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, 8u, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >::getBuckets() const total: 24 2.5e-04 */ | |
/* (anonymous namespace)::AggLoadStoreRewriter::AggLoadStoreRewriter() total: 82 8.6e-04 */ | |
/* llvm::SmallVectorImpl<(anonymous namespace)::Slice*>::erase((anonymous namespace)::Slice* const*, (anonymous namespace)::Slice* const*) total: 19 2.0e-04 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::~IRBuilder() total: 147 0.0015 */ | |
/* (anonymous namespace)::AggLoadStoreRewriter::OpSplitter<(anonymous namespace)::AggLoadStoreRewriter::LoadOpSplitter>::~OpSplitter() total: 2 2.1e-05 */ | |
/* (anonymous namespace)::AggLoadStoreRewriter::OpSplitter<(anonymous namespace)::AggLoadStoreRewriter::StoreOpSplitter>::~OpSplitter() total: 6 6.3e-05 */ | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, 8u, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >, llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >::getBucketsEnd() total: 55 5.8e-04 */ | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, 8u, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >, llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >::end() total: 15 1.6e-04 */ | |
/* bool llvm::DenseMapBase<llvm::SmallDenseMap<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, 8u, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >, llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >::LookupBucketFor<llvm::Instruction*>(llvm::Instruction* const&, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> const*&) const total: 21 2.2e-04 */ | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, 8u, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >, llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >::initEmpty() total: 115 0.0012 */ | |
/* llvm::SmallDenseMap<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets, 8u, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::SplitOffsets> >::~SmallDenseMap() total: 129 0.0014 */ | |
/* void std::__introsort_loop<(anonymous namespace)::Slice*, long>((anonymous namespace)::Slice*, (anonymous namespace)::Slice*, long) total: 127 0.0013 */ | |
/* void std::sort<(anonymous namespace)::Slice*>((anonymous namespace)::Slice*, (anonymous namespace)::Slice*) total: 84 8.8e-04 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.1046] total: 44 4.6e-04 */ | |
/* llvm::LoadInst** std::remove_if<llvm::LoadInst**, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::LoadInst*)#4}>(llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::LoadInst*)#4}, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::LoadInst*)#4}, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::LoadInst*)#4}) total: 125 0.0013 */ | |
/* llvm::Twine::Twine(llvm::StringRef const&, char const*) [clone .constprop.1062] total: 12 1.3e-04 */ | |
/* (anonymous namespace)::IRBuilderPrefixedInserter::getNameWithPrefix(llvm::Twine const&) const total: 313 0.0033 */ | |
/* speculateSelectInstLoads(llvm::SelectInst&) total: 2 2.1e-05 */ | |
/* llvm::GetElementPtrInst* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::Insert<llvm::GetElementPtrInst>(llvm::GetElementPtrInst*, llvm::Twine const&) const total: 136 0.0014 */ | |
/* llvm::LoadInst* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::Insert<llvm::LoadInst>(llvm::LoadInst*, llvm::Twine const&) const total: 129 0.0014 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::CreateLoad(llvm::Value*, char const*) total: 44 4.6e-04 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::CreateLoad(llvm::Value*, bool, llvm::Twine const&) total: 53 5.6e-04 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::CreateAlignedLoad(llvm::Value*, unsigned int, bool, llvm::Twine const&) total: 68 7.1e-04 */ | |
/* llvm::StoreInst* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::Insert<llvm::StoreInst>(llvm::StoreInst*, llvm::Twine const&) const total: 94 9.9e-04 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::CreateStore(llvm::Value*, llvm::Value*, bool) total: 162 0.0017 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::CreateAlignedStore(llvm::Value*, llvm::Value*, unsigned int, bool) total: 34 3.6e-04 */ | |
/* llvm::BinaryOperator* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::Insert<llvm::BinaryOperator>(llvm::BinaryOperator*, llvm::Twine const&) const total: 3 3.1e-05 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::CreateInsertNUWNSWBinOp(llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, llvm::Twine const&, bool, bool) total: 1 1.0e-05 */ | |
/* llvm::StoreInst** std::remove_if<llvm::StoreInst**, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::StoreInst*)#3}>(llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::StoreInst*)#3}, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::StoreInst*)#3}, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::StoreInst*)#3}) total: 111 0.0012 */ | |
/* stripAggregateTypeWrapping(llvm::DataLayout const&, llvm::Type*) total: 68 7.1e-04 */ | |
/* canConvertValue(llvm::DataLayout const&, llvm::Type*, llvm::Type*) total: 407 0.0043 */ | |
/* getTypePartition(llvm::DataLayout const&, llvm::Type*, unsigned long, unsigned long) total: 71 7.5e-04 */ | |
/* llvm::StoreInst** std::remove_if<llvm::StoreInst**, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::StoreInst*)#2}>(llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::StoreInst*)#2}, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::StoreInst*)#2}, llvm::SROA::presplitLoadsAndStores(llvm::AllocaInst&, llvm::sroa::AllocaSlices&)::{lambda(llvm::StoreInst*)#2}) total: 134 0.0014 */ | |
/* (anonymous namespace)::AggLoadStoreRewriter::enqueueUsers(llvm::Instruction&) total: 710 0.0075 */ | |
/* findCommonType((anonymous namespace)::Slice const*, (anonymous namespace)::Slice const*, unsigned long) total: 363 0.0038 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::CreateShl(llvm::Value*, unsigned long, llvm::Twine const&, bool, bool) [clone .constprop.1019] total: 1 1.0e-05 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&) total: 323 0.0034 */ | |
/* extractInteger(llvm::DataLayout const&, llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>&, llvm::Value*, llvm::IntegerType*, unsigned long, llvm::Twine const&) total: 1 1.0e-05 */ | |
/* convertValue(llvm::DataLayout const&, llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>&, llvm::Value*, llvm::Type*) total: 218 0.0023 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>::CreateInBoundsGEP(llvm::Type*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&) [clone .constprop.1022] total: 100 0.0010 */ | |
/* buildGEP(llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>&, llvm::Value*, llvm::SmallVectorImpl<llvm::Value*>&, llvm::Twine) total: 256 0.0027 */ | |
/* (anonymous namespace)::AggLoadStoreRewriter::StoreOpSplitter::emitFunc(llvm::Type*, llvm::Value*&, llvm::Twine const&) total: 25 2.6e-04 */ | |
/* (anonymous namespace)::AggLoadStoreRewriter::LoadOpSplitter::emitFunc(llvm::Type*, llvm::Value*&, llvm::Twine const&) total: 16 1.7e-04 */ | |
/* getNaturalGEPWithType(llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>&, llvm::DataLayout const&, llvm::Value*, llvm::Type*, llvm::Type*, llvm::SmallVectorImpl<llvm::Value*>&, llvm::Twine) total: 292 0.0031 */ | |
/* getNaturalGEPRecursively(llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>&, llvm::DataLayout const&, llvm::Value*, llvm::Type*, llvm::APInt&, llvm::Type*, llvm::SmallVectorImpl<llvm::Value*>&, llvm::Twine) total: 266 0.0028 */ | |
/* getAdjustedPtr(llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>&, llvm::DataLayout const&, llvm::Value*, llvm::APInt, llvm::Type*, llvm::Twine) total: 1405 0.0148 */ | |
/* llvm::sroa::AllocaSliceRewriter::getNewAllocaSlicePtr(llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>&, llvm::Type*) total: 518 0.0054 */ | |
/* isIntegerWideningViableForSlice((anonymous namespace)::Slice const&, unsigned long, llvm::Type*, llvm::DataLayout const&, bool&) total: 372 0.0039 */ | |
/* isIntegerWideningViable(llvm::sroa::Partition&, llvm::Type*, llvm::DataLayout const&) total: 259 0.0027 */ | |
/* isVectorPromotionViable(llvm::sroa::Partition&, llvm::DataLayout const&)::{lambda(llvm::Type*)#1}::operator()(llvm::Type*) const total: 17 1.8e-04 */ | |
/* isVectorPromotionViable(llvm::sroa::Partition&, llvm::DataLayout const&) total: 186 0.0020 */ | |
/* (anonymous namespace)::AggLoadStoreRewriter::OpSplitter<(anonymous namespace)::AggLoadStoreRewriter::LoadOpSplitter>::emitSplitOps(llvm::Type*, llvm::Value*&, llvm::Twine const&) total: 25 2.6e-04 */ | |
/* (anonymous namespace)::AggLoadStoreRewriter::OpSplitter<(anonymous namespace)::AggLoadStoreRewriter::StoreOpSplitter>::emitSplitOps(llvm::Type*, llvm::Value*&, llvm::Twine const&) total: 22 2.3e-04 */ | |
/* insertInteger(llvm::DataLayout const&, llvm::IRBuilder<llvm::ConstantFolder, (anonymous namespace)::IRBuilderPrefixedInserter>&, llvm::Value*, llvm::Value*, unsigned long, llvm::Twine const&) total: 10 1.0e-04 */ | |
/* (anonymous namespace)::AggLoadStoreRewriter::rewrite(llvm::Instruction&) total: 889 0.0093 */ | |
/* bool llvm::SetVector<llvm::AllocaInst*, llvm::SmallVector<llvm::AllocaInst*, 16u>, llvm::DenseSet<llvm::AllocaInst*, llvm::DenseMapInfo<llvm::AllocaInst*> > >::TestAndEraseFromSet<llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&)::{lambda(llvm::AllocaInst*)#1}>::operator()<llvm::AllocaInst*>(llvm::AllocaInst* const&) total: 19 2.0e-04 */ | |
/* llvm::AllocaInst** std::__find_if<llvm::AllocaInst**, llvm::SetVector<llvm::AllocaInst*, llvm::SmallVector<llvm::AllocaInst*, 16u>, llvm::DenseSet<llvm::AllocaInst*, llvm::DenseMapInfo<llvm::AllocaInst*> > >::TestAndEraseFromSet<llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&)::{lambda(llvm::AllocaInst*)#1}> >(llvm::SetVector<llvm::AllocaInst*, llvm::SmallVector<llvm::AllocaInst*, 16u>, llvm::DenseSet<llvm::AllocaInst*, llvm::DenseMapInfo<llvm::AllocaInst*> > >::TestAndEraseFromSet<llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&)::{lambda(llvm::AllocaInst*)#1}>, llvm::SetVector<llvm::AllocaInst*, llvm::SmallVector<llvm::AllocaInst*, 16u>, llvm::DenseSet<llvm::AllocaInst*, llvm::DenseMapInfo<llvm::AllocaInst*> > >::TestAndEraseFromSet<llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&)::{lambda(llvm::AllocaInst*)#1}>, llvm::SetVector<llvm::AllocaInst*, llvm::SmallVector<llvm::AllocaInst*, 16u>, llvm::DenseSet<llvm::AllocaInst*, llvm::DenseMapInfo<llvm::AllocaInst*> > >::TestAndEraseFromSet<llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&)::{lambda(llvm::AllocaInst*)#1}>, std::random_access_iterator_tag) [clone .isra.926] total: 145 0.0015 */ | |
/* llvm::sroa::AllocaSliceRewriter::deleteIfTriviallyDead(llvm::Value*) [clone .isra.966] total: 48 5.0e-04 */ | |
/* llvm::sroa::AllocaSliceRewriter::visit((anonymous namespace)::Slice const*) total: 1211 0.0127 */ | |
/* | |
* Total samples for file : "/root/.cargo/git/checkouts/hyper-817b53a166fc1c58/499c0d1/src/http/buf.rs" | |
* | |
* 12370 0.1299 | |
*/ | |
:use std::borrow::Cow; | |
:use std::cell::{Cell, UnsafeCell}; | |
:use std::fmt; | |
:use std::io::{self, Read}; | |
:use std::ops::{Index, Range, RangeFrom, RangeTo, RangeFull}; | |
:use std::ptr; | |
:use std::str; | |
:use std::sync::Arc; | |
: | |
:pub struct MemBuf { | |
: buf: Arc<UnsafeCell<Vec<u8>>>, | |
: start: Cell<usize>, | |
: end: usize, | |
:} | |
: | |
:impl MemBuf { | |
: pub fn new() -> MemBuf { | |
: MemBuf::with_capacity(0) | |
: } | |
: | |
: pub fn with_capacity(cap: usize) -> MemBuf { | |
60 6.3e-04 : MemBuf { | |
66 6.9e-04 : buf: Arc::new(UnsafeCell::new(vec![0; cap])), | |
: start: Cell::new(0), | |
: end: 0, | |
: } | |
: } | |
: | |
: pub fn bytes(&self) -> &[u8] { | |
1 1.0e-05 : &self.buf()[self.start.get()..self.end] | |
: } | |
: | |
1839 0.0193 : pub fn is_empty(&self) -> bool { /* hyper::http::buf::MemBuf::is_empty::hdacdfd8e0337ac04 total: 3357 0.0352 */ | |
1410 0.0148 : self.len() == 0 | |
92 9.7e-04 : } | |
: | |
8 8.4e-05 : pub fn len(&self) -> usize { /* hyper::http::buf::MemBuf::len::ha45360c39681846a total: 11 1.2e-04 */ | |
19 2.0e-04 : self.end - self.start.get() | |
1 1.0e-05 : } | |
: | |
5 5.2e-05 : pub fn capacity(&self) -> usize { /* hyper::http::buf::MemBuf::capacity::he285c9d9ee9edb53 total: 7 7.3e-05 */ | |
: self.buf().len() | |
2 2.1e-05 : } | |
: | |
: pub fn read_from<R: Read>(&mut self, io: &mut R) -> io::Result<usize> { | |
151 0.0016 : let start = self.end - self.start.get(); | |
138 0.0014 : let n = try!(io.read(&mut self.buf_mut()[start..])); | |
713 0.0075 : self.end += n; | |
: Ok(n) | |
: } | |
: | |
: pub fn slice(&self, len: usize) -> MemSlice { | |
: let start = self.start.get(); | |
538 0.0056 : assert!(!(self.end - start < len)); | |
102 0.0011 : let end = start + len; | |
: self.start.set(end); | |
127 0.0013 : MemSlice { | |
: buf: self.buf.clone(), | |
: start: start, | |
: end: end, | |
: } | |
131 0.0014 : } | |
: | |
26 2.7e-04 : pub fn reserve(&mut self, needed: usize) { /* hyper::http::buf::MemBuf::reserve::h8b11fe7dbcb5f419 total: 96 0.0010 */ | |
6 6.3e-05 : let orig_cap = self.capacity(); | |
24 2.5e-04 : let remaining = orig_cap - self.end; | |
1 1.0e-05 : if remaining >= needed { | |
: // all done | |
: return | |
: } | |
: let is_unique = Arc::get_mut(&mut self.buf).is_some(); | |
: trace!("MemBuf::reserve {} access", if is_unique { "unique" } else { "shared" }); | |
1 1.0e-05 : if is_unique && remaining + self.start.get() >= needed { | |
: // we have unique access, we can mutate this vector | |
: trace!("MemBuf::reserve unique access, shifting"); | |
: unsafe { | |
: let mut buf = &mut *self.buf.get(); | |
: let len = self.len(); | |
: ptr::copy( | |
: buf.as_ptr().offset(self.start.get() as isize), | |
: buf.as_mut_ptr(), | |
: len | |
: ); | |
: self.start.set(0); | |
: self.end = len; | |
: } | |
: } else if is_unique { | |
: // we have unique access, we can mutate this vector | |
: trace!("MemBuf::reserve unique access, growing"); | |
: unsafe { | |
: let mut vec = &mut *self.buf.get(); | |
: grow_zerofill(vec, needed); | |
: } | |
: } else { | |
: // we need to allocate more space, but don't have unique | |
: // access, so we need to make a new buffer | |
: trace!("MemBuf::reserve shared buffer, creating new"); | |
: let mut new = MemBuf::with_capacity(needed); | |
: unsafe { | |
: ptr::copy_nonoverlapping( | |
: self.bytes().as_ptr(), | |
: new.buf_mut().as_mut_ptr(), | |
: self.len() | |
: ); | |
: } | |
: new.end = self.len(); | |
: *self = new; | |
: } | |
11 1.2e-04 : } | |
: | |
1369 0.0144 : pub fn reset(&mut self) { /* hyper::http::buf::MemBuf::reset::hfd4c9f216a759a33 total: 14044 0.1475 */ | |
: match Arc::get_mut(&mut self.buf) { | |
: Some(_) => { | |
: trace!("MemBuf::reset was unique, re-using"); | |
: self.start.set(0); | |
: self.end = 0; | |
: }, | |
: None => { | |
: trace!("MemBuf::reset not unique, creating new MemBuf"); | |
128 0.0013 : *self = MemBuf::with_capacity(self.buf().len()); | |
: } | |
: } | |
294 0.0031 : } | |
: | |
: #[cfg(all(feature = "nightly", test))] | |
: pub fn restart(&mut self) { | |
: Arc::get_mut(&mut self.buf).unwrap(); | |
: self.start.set(0); | |
: } | |
: | |
123 0.0013 : fn buf_mut(&mut self) -> &mut [u8] { /* hyper::http::buf::MemBuf::buf_mut::h4939efbeaf5fe411 total: 467 0.0049 */ | |
: // The contract here is that we NEVER have a MemSlice that exists | |
: // with slice.end > self.start. | |
: // In other words, we should *ALWAYS* be the only instance that can | |
: // look at the bytes on the right side of self.start. | |
: unsafe { | |
: &mut (*self.buf.get())[self.start.get()..] | |
: } | |
47 4.9e-04 : } | |
: | |
: fn buf(&self) -> &Vec<u8> { | |
: unsafe { | |
: &*self.buf.get() | |
: } | |
: } | |
:} | |
: | |
:#[inline] | |
:unsafe fn grow_zerofill(buf: &mut Vec<u8>, additional: usize) { | |
: let orig_cap = buf.capacity(); | |
: buf.reserve(additional); | |
: let new_cap = buf.capacity(); | |
: let reserved = new_cap - orig_cap; | |
: let orig_len = buf.len(); | |
: zero(buf, orig_len, reserved); | |
: buf.set_len(orig_len + reserved); | |
: | |
: | |
: unsafe fn zero(buf: &mut Vec<u8>, offset: usize, len: usize) { | |
: assert!(buf.capacity() >= len + offset, | |
: "offset of {} with len of {} is bigger than capacity of {}", | |
: offset, len, buf.capacity()); | |
: ptr::write_bytes(buf.as_mut_ptr().offset(offset as isize), 0, len); | |
: } | |
:} | |
: | |
:#[test] | |
:fn test_grow_zerofill() { | |
: for init in 0..100 { | |
: for reserve in (0..100).rev() { | |
: let mut vec = vec![0; init]; | |
: unsafe { grow_zerofill(&mut vec, reserve) } | |
: assert_eq!(vec.len(), vec.capacity()); | |
: } | |
: } | |
:} | |
: | |
:impl fmt::Debug for MemBuf { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: f.debug_struct("MemBuf") | |
: .field("start", &self.start.get()) | |
: .field("end", &self.end) | |
: .field("buf", &&self.buf()[self.start.get()..self.end]) | |
: .finish() | |
: } | |
:} | |
: | |
:impl From<Vec<u8>> for MemBuf { | |
: fn from(mut vec: Vec<u8>) -> MemBuf { | |
: let end = vec.iter().find(|&&x| x == 0).map(|&x| x as usize).unwrap_or(vec.len()); | |
: vec.shrink_to_fit(); | |
: MemBuf { | |
: buf: Arc::new(UnsafeCell::new(vec)), | |
: start: Cell::new(0), | |
: end: end, | |
: } | |
: } | |
:} | |
: | |
:#[derive(Debug, Clone, PartialEq, Eq)] | |
:pub struct MemStr(MemSlice); | |
: | |
:impl MemStr { | |
: pub unsafe fn from_utf8_unchecked(slice: MemSlice) -> MemStr { | |
: MemStr(slice) | |
: } | |
: | |
: pub fn as_str(&self) -> &str { | |
: unsafe { str::from_utf8_unchecked(self.0.as_ref()) } | |
: } | |
:} | |
: | |
:pub struct MemSlice { | |
: buf: Arc<UnsafeCell<Vec<u8>>>, | |
: start: usize, | |
: end: usize, | |
:} | |
: | |
:impl MemSlice { | |
11 1.2e-04 : pub fn empty() -> MemSlice { /* hyper::http::buf::MemSlice::empty::hbae5aabfd7a86bbd total: 13 1.4e-04 */ | |
: MemSlice { | |
: buf: Arc::new(UnsafeCell::new(Vec::new())), | |
: start: 0, | |
: end: 0, | |
: } | |
: } | |
: | |
: pub fn len(&self) -> usize { | |
: self.get().len() | |
: } | |
: | |
1411 0.0148 : pub fn is_empty(&self) -> bool { /* hyper::http::buf::MemSlice::is_empty::h5fc65b1b1d83df67 total: 2282 0.0240 */ | |
138 0.0014 : self.get().is_empty() | |
23 2.4e-04 : } | |
: | |
: pub fn slice<S: Slice>(&self, range: S) -> MemSlice { | |
: range.slice(self) | |
: } | |
: | |
: fn get(&self) -> &[u8] { | |
586 0.0062 : unsafe { &(*self.buf.get())[self.start..self.end] } | |
: } | |
:} | |
: | |
:impl AsRef<[u8]> for MemSlice { | |
1708 0.0179 : fn as_ref(&self) -> &[u8] { /* _$LT$hyper..http..buf..MemSlice$u20$as$u20$core..convert..AsRef$LT$$u5b$u8$u5d$$GT$$GT$::as_ref::h22edf2df454923f7 total: 5285 0.0555 */ | |
445 0.0047 : self.get() | |
613 0.0064 : } | |
:} | |
: | |
:impl fmt::Debug for MemSlice { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: fmt::Debug::fmt(&self.get(), f) | |
: } | |
:} | |
: | |
:impl Index<usize> for MemSlice { | |
: type Output = u8; | |
: fn index(&self, i: usize) -> &u8 { | |
: &self.get()[i] | |
: } | |
:} | |
: | |
:impl<'a> From<&'a [u8]> for MemSlice { | |
: fn from(v: &'a [u8]) -> MemSlice { | |
: MemSlice { | |
: buf: Arc::new(UnsafeCell::new(v.to_vec())), | |
: start: 0, | |
: end: v.len(), | |
: } | |
: } | |
:} | |
: | |
:impl From<Vec<u8>> for MemSlice { | |
: fn from(v: Vec<u8>) -> MemSlice { | |
: let len = v.len(); | |
: MemSlice { | |
: buf: Arc::new(UnsafeCell::new(v)), | |
: start: 0, | |
: end: len, | |
: } | |
: } | |
:} | |
: | |
:impl<'a> From<&'a str> for MemSlice { | |
: fn from(v: &'a str) -> MemSlice { | |
: let v = v.as_bytes(); | |
: MemSlice { | |
: buf: Arc::new(UnsafeCell::new(v.to_vec())), | |
: start: 0, | |
: end: v.len(), | |
: } | |
: } | |
:} | |
: | |
:impl<'a> From<Cow<'a, [u8]>> for MemSlice { | |
: fn from(v: Cow<'a, [u8]>) -> MemSlice { | |
: let v = v.into_owned(); | |
: let len = v.len(); | |
: MemSlice { | |
: buf: Arc::new(UnsafeCell::new(v)), | |
: start: 0, | |
: end: len, | |
: } | |
: } | |
:} | |
: | |
:impl PartialEq for MemSlice { | |
: fn eq(&self, other: &MemSlice) -> bool { | |
: self.get() == other.get() | |
: } | |
:} | |
: | |
:impl PartialEq<[u8]> for MemSlice { | |
: fn eq(&self, other: &[u8]) -> bool { | |
: self.get() == other | |
: } | |
:} | |
: | |
:impl PartialEq<str> for MemSlice { | |
: fn eq(&self, other: &str) -> bool { | |
: self.get() == other.as_bytes() | |
: } | |
:} | |
: | |
:impl PartialEq<Vec<u8>> for MemSlice { | |
: fn eq(&self, other: &Vec<u8>) -> bool { | |
: self.get() == other.as_slice() | |
: } | |
:} | |
: | |
:impl Eq for MemSlice {} | |
: | |
:impl Clone for MemSlice { | |
: fn clone(&self) -> MemSlice { | |
: MemSlice { | |
: buf: self.buf.clone(), | |
: start: self.start, | |
: end: self.end, | |
: } | |
: } | |
:} | |
: | |
:pub trait Slice { | |
: fn slice(self, subject: &MemSlice) -> MemSlice; | |
:} | |
: | |
: | |
:impl Slice for Range<usize> { | |
: fn slice(self, subject: &MemSlice) -> MemSlice { | |
1 1.0e-05 : assert!(subject.start + self.start <= subject.end); | |
1 1.0e-05 : assert!(subject.start + self.end <= subject.end); | |
: MemSlice { | |
: buf: subject.buf.clone(), | |
: start: subject.start + self.start, | |
: end: subject.start + self.end, | |
: } | |
: } | |
:} | |
: | |
:impl Slice for RangeFrom<usize> { | |
: fn slice(self, subject: &MemSlice) -> MemSlice { | |
: assert!(subject.start + self.start <= subject.end); | |
: MemSlice { | |
: buf: subject.buf.clone(), | |
: start: subject.start + self.start, | |
: end: subject.end, | |
: } | |
: } | |
:} | |
: | |
:impl Slice for RangeTo<usize> { | |
: fn slice(self, subject: &MemSlice) -> MemSlice { | |
: assert!(subject.start + self.end <= subject.end); | |
: MemSlice { | |
: buf: subject.buf.clone(), | |
: start: subject.start, | |
: end: subject.start + self.end, | |
: } | |
: } | |
:} | |
: | |
:impl Slice for RangeFull { | |
: fn slice(self, subject: &MemSlice) -> MemSlice { | |
: MemSlice { | |
: buf: subject.buf.clone(), | |
: start: subject.start, | |
: end: subject.end, | |
: } | |
: } | |
:} | |
: | |
:unsafe impl Send for MemBuf {} | |
:unsafe impl Send for MemSlice {} | |
: | |
:#[cfg(test)] | |
:impl<T: Read> ::http::io::MemRead for ::mock::AsyncIo<T> { | |
: fn read_mem(&mut self, len: usize) -> io::Result<MemSlice> { | |
: let mut v = vec![0; len]; | |
: let n = try!(self.read(v.as_mut_slice())); | |
: v.truncate(n); | |
: Ok(MemSlice { | |
: buf: Arc::new(UnsafeCell::new(v)), | |
: start: 0, | |
: end: n, | |
: }) | |
: } | |
:} | |
: | |
:#[cfg(test)] | |
:mod tests { | |
: use super::{MemBuf}; | |
: | |
: #[test] | |
: fn test_mem_slice_slice() { | |
: let buf = MemBuf::from(b"Hello World".to_vec()); | |
: | |
: let len = buf.len(); | |
: let full = buf.slice(len); | |
: | |
: assert_eq!(full.as_ref(), b"Hello World"); | |
: assert_eq!(full.slice(6..).as_ref(), b"World"); | |
: assert_eq!(full.slice(..5).as_ref(), b"Hello"); | |
: assert_eq!(full.slice(..).as_ref(), b"Hello World"); | |
: for a in 0..len { | |
: for b in a..len { | |
: assert_eq!(full.slice(a..b).as_ref(), &b"Hello World"[a..b], "{}..{}", a, b); | |
: } | |
: } | |
: } | |
:} | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/misc/../sysdeps/unix/syscall-template.S" | |
* | |
* 12308 0.1292 | |
*/ | |
/* mmap total: 4 4.2e-05 */ | |
/* mprotect total: 2 2.1e-05 */ | |
/* ioctl total: 16 1.7e-04 */ | |
/* epoll_wait total: 7250 0.0761 */ | |
/* __epoll_wait_nocancel total: 4930 0.0518 */ | |
/* mmap64 total: 7 7.3e-05 */ | |
/* munmap total: 3 3.1e-05 */ | |
/* madvise total: 24 2.5e-04 */ | |
/* lseek total: 4 4.2e-05 */ | |
/* __lseek_nocancel total: 68 7.1e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/str/mod.rs" | |
* | |
* 12114 0.1272 | |
*/ | |
/* core::str::from_utf8::hfa7fae688110c9f1 total: 38 4.0e-04 */ | |
/* core::str::from_utf8::hfa7fae688110c9f1 total: 11935 0.1253 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/result.rs" | |
* | |
* 12094 0.1270 | |
*/ | |
/* | |
* Total samples for file : "/checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/ticker.h" | |
* | |
* 11968 0.1257 | |
*/ | |
/* je_ticker_tick total: 94 9.9e-04 */ | |
/* je_ticker_tick total: 4 4.2e-05 */ | |
/* | |
* Total samples for file : "/root/.cargo/git/checkouts/hyper-817b53a166fc1c58/499c0d1/src/http/io.rs" | |
* | |
* 11705 0.1229 | |
*/ | |
:use std::cmp; | |
:use std::fmt; | |
:use std::io::{self, Read, Write}; | |
:use std::ptr; | |
: | |
:use futures::Async; | |
:use tokio::io::Io; | |
: | |
:use http::{Http1Transaction, h1, MessageHead, ParseResult}; | |
:use http::buf::{MemBuf, MemSlice}; | |
: | |
:const INIT_BUFFER_SIZE: usize = 4096; | |
:pub const MAX_BUFFER_SIZE: usize = 8192 + 4096 * 100; | |
: | |
:pub struct Buffered<T> { | |
: io: T, | |
: read_buf: MemBuf, | |
: write_buf: WriteBuf, | |
:} | |
: | |
:impl<T> fmt::Debug for Buffered<T> { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: f.debug_struct("Buffered") | |
: .field("read_buf", &self.read_buf) | |
: .field("write_buf", &self.write_buf) | |
: .finish() | |
: } | |
:} | |
: | |
:impl<T: Io> Buffered<T> { | |
: pub fn new(io: T) -> Buffered<T> { | |
: Buffered { | |
: io: io, | |
: read_buf: MemBuf::new(), | |
: write_buf: WriteBuf::new(), | |
: } | |
: } | |
: | |
: pub fn read_buf(&self) -> &[u8] { | |
: self.read_buf.bytes() | |
: } | |
: | |
: pub fn consume_leading_lines(&mut self) { | |
: if !self.read_buf.is_empty() { | |
: let mut i = 0; | |
: while i < self.read_buf.len() { | |
: match self.read_buf.bytes()[i] { | |
: b'\r' | b'\n' => i += 1, | |
: _ => break, | |
: } | |
: } | |
: self.read_buf.slice(i); | |
: } | |
: } | |
: | |
: pub fn poll_read(&mut self) -> Async<()> { | |
89 9.3e-04 : self.io.poll_read() | |
: } | |
: | |
: pub fn parse<S: Http1Transaction>(&mut self) -> ::Result<Option<MessageHead<S::Incoming>>> { | |
: self.reserve_read_buf(); | |
: match self.read_buf.read_from(&mut self.io) { | |
10 1.0e-04 : Ok(0) => { | |
: trace!("parse eof"); | |
: return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "parse eof").into()); | |
: } | |
: Ok(_) => {}, | |
2 2.1e-05 : Err(e) => match e.kind() { | |
: io::ErrorKind::WouldBlock => {}, | |
: _ => return Err(e.into()) | |
: } | |
2 2.1e-05 : } | |
: match try!(parse::<S, _>(&self.read_buf)) { | |
: Some(head) => { | |
: //trace!("parsed {} bytes out of {}", len, self.read_buf.len()); | |
: //self.read_buf.slice(len); | |
1 1.0e-05 : Ok(Some(head.0)) | |
: }, | |
: None => { | |
4 4.2e-05 : if self.read_buf.capacity() >= MAX_BUFFER_SIZE { | |
: debug!("MAX_BUFFER_SIZE reached, closing"); | |
: Err(::Error::TooLarge) | |
: } else { | |
8 8.4e-05 : Ok(None) | |
: } | |
: }, | |
: } | |
7 7.3e-05 : } | |
: | |
: fn reserve_read_buf(&mut self) { | |
4 4.2e-05 : self.read_buf.reserve(INIT_BUFFER_SIZE); | |
: } | |
: | |
: pub fn buffer<B: AsRef<[u8]>>(&mut self, buf: B) { | |
: self.write_buf.buffer(buf.as_ref()); | |
: } | |
: | |
: #[cfg(test)] | |
: pub fn io_mut(&mut self) -> &mut T { | |
: &mut self.io | |
: } | |
:} | |
: | |
:/* | |
:impl<T: Read> Read for Buffered<T> { | |
: fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { | |
: trace!("Buffered.read self={}, buf={}", self.read_buf.len(), buf.len()); | |
: unimplemented!() | |
: /* | |
: let n = try!(self.read_buf.bytes().read(buf)); | |
: self.read_buf.consume(n); | |
: if n == 0 { | |
: self.read_buf.reset(); | |
: self.io.read(&mut buf[n..]) | |
: } else { | |
: Ok(n) | |
: } | |
: */ | |
: } | |
:} | |
:*/ | |
: | |
:impl<T: Write> Write for Buffered<T> { | |
: fn write(&mut self, data: &[u8]) -> io::Result<usize> { | |
: Ok(self.write_buf.buffer(data)) | |
: } | |
: | |
: fn flush(&mut self) -> io::Result<()> { | |
763 0.0080 : if self.write_buf.remaining() == 0 { | |
264 0.0028 : Ok(()) | |
: } else { | |
: loop { | |
: let n = try!(self.write_buf.write_into(&mut self.io)); | |
: debug!("flushed {} bytes", n); | |
1 1.0e-05 : if self.write_buf.remaining() == 0 { | |
1 1.0e-05 : return Ok(()) | |
: } | |
: } | |
: } | |
: } | |
:} | |
: | |
:fn parse<T: Http1Transaction<Incoming=I>, I>(rdr: &MemBuf) -> ParseResult<I> { | |
: h1::parse::<T, I>(rdr) | |
:} | |
: | |
:pub trait MemRead { | |
: fn read_mem(&mut self, len: usize) -> io::Result<MemSlice>; | |
:} | |
: | |
:impl<T: Read> MemRead for Buffered<T> { | |
2316 0.0243 : fn read_mem(&mut self, len: usize) -> io::Result<MemSlice> { /* _$LT$hyper..http..io..Buffered$LT$T$GT$$u20$as$u20$hyper..http..io..MemRead$GT$::read_mem::h64b7ecd36d76ca3e total: 10075 0.1058 */ | |
: trace!("Buffered.read_mem read_buf={}, wanted={}", self.read_buf.len(), len); | |
730 0.0077 : if !self.read_buf.is_empty() { | |
1 1.0e-05 : let n = ::std::cmp::min(len, self.read_buf.len()); | |
: trace!("Buffered.read_mem read_buf is not empty, slicing {}", n); | |
1829 0.0192 : Ok(self.read_buf.slice(n)) | |
: } else { | |
122 0.0013 : self.read_buf.reset(); | |
: let n = try!(self.read_buf.read_from(&mut self.io)); | |
1182 0.0124 : Ok(self.read_buf.slice(::std::cmp::min(len, n))) | |
: } | |
472 0.0050 : } | |
:} | |
: | |
:#[derive(Clone)] | |
:pub struct Cursor<T: AsRef<[u8]>> { | |
: bytes: T, | |
: pos: usize, | |
:} | |
: | |
:impl<T: AsRef<[u8]>> Cursor<T> { | |
: pub fn new(bytes: T) -> Cursor<T> { | |
: Cursor { | |
: bytes: bytes, | |
: pos: 0, | |
: } | |
: } | |
: | |
: pub fn is_written(&self) -> bool { | |
: trace!("Cursor::is_written pos = {}, len = {}", self.pos, self.bytes.as_ref().len()); | |
: self.pos >= self.bytes.as_ref().len() | |
: } | |
: | |
: pub fn write_to<W: Write>(&mut self, dst: &mut W) -> io::Result<usize> { | |
: if self.remaining() == 0 { | |
: Ok(0) | |
: } else { | |
2 2.1e-05 : dst.write(&self.bytes.as_ref()[self.pos..]).map(|n| { | |
2 2.1e-05 : self.pos += n; | |
: n | |
: }) | |
: } | |
: } | |
: | |
: fn remaining(&self) -> usize { | |
1861 0.0195 : self.bytes.as_ref().len() - self.pos | |
: } | |
: | |
: #[inline] | |
: pub fn buf(&self) -> &[u8] { | |
: &self.bytes.as_ref()[self.pos..] | |
: } | |
: | |
: #[inline] | |
: pub fn consume(&mut self, num: usize) { | |
: trace!("Cursor::consume({})", num); | |
: self.pos = ::std::cmp::min(self.bytes.as_ref().len(), self.pos + num); | |
: } | |
:} | |
: | |
:impl<T: AsRef<[u8]>> fmt::Debug for Cursor<T> { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: let bytes = self.buf(); | |
: if bytes.len() > 32 { | |
: try!(f.write_str("Cursor([")); | |
: for byte in &bytes[..32] { | |
: try!(write!(f, "{:?}, ", byte)); | |
: } | |
: write!(f, "... {}])", bytes.len()) | |
: } else { | |
: write!(f, "Cursor({:?})", &bytes) | |
: } | |
: } | |
:} | |
: | |
:pub trait AtomicWrite { | |
: fn write_atomic(&mut self, data: &[&[u8]]) -> io::Result<usize>; | |
:} | |
: | |
:/* | |
:#[cfg(not(windows))] | |
:impl<T: Write + ::vecio::Writev> AtomicWrite for T { | |
: | |
: fn write_atomic(&mut self, bufs: &[&[u8]]) -> io::Result<usize> { | |
: self.writev(bufs) | |
: } | |
: | |
:} | |
: | |
:#[cfg(windows)] | |
:*/ | |
:impl<T: Write> AtomicWrite for T { | |
: fn write_atomic(&mut self, bufs: &[&[u8]]) -> io::Result<usize> { | |
: if bufs.len() == 1 { | |
: self.write(bufs[0]) | |
: } else { | |
: let vec = bufs.concat(); | |
: self.write(&vec) | |
: } | |
: } | |
:} | |
://} | |
: | |
:// an internal buffer to collect writes before flushes | |
:#[derive(Debug)] | |
:struct WriteBuf(Cursor<Vec<u8>>); | |
: | |
:impl WriteBuf { | |
: fn new() -> WriteBuf { | |
: WriteBuf(Cursor::new(Vec::new())) | |
: } | |
: | |
: fn write_into<W: Write>(&mut self, w: &mut W) -> io::Result<usize> { | |
: self.0.write_to(w) | |
: } | |
: | |
11 1.2e-04 : fn buffer(&mut self, data: &[u8]) -> usize { /* hyper::http::io::WriteBuf::buffer::hac55e6498012828f total: 31 3.3e-04 */ | |
: trace!("WriteBuf::buffer() len = {:?}", data.len()); | |
: self.maybe_reset(); | |
: self.maybe_reserve(data.len()); | |
: let mut vec = &mut self.0.bytes; | |
7 7.3e-05 : let len = cmp::min(vec.capacity() - vec.len(), data.len()); | |
: assert!(vec.capacity() - vec.len() >= len); | |
: unsafe { | |
: // in rust 1.9, we could use slice::copy_from_slice | |
: ptr::copy( | |
: data.as_ptr(), | |
: vec.as_mut_ptr().offset(vec.len() as isize), | |
: len | |
: ); | |
: let new_len = vec.len() + len; | |
: vec.set_len(new_len); | |
: } | |
: len | |
: } | |
: | |
1805 0.0190 : fn remaining(&self) -> usize { /* hyper::http::io::WriteBuf::remaining::hf57538e86d6d12a3 total: 3866 0.0406 */ | |
8 8.4e-05 : self.0.remaining() | |
194 0.0020 : } | |
: | |
: #[inline] | |
: fn maybe_reserve(&mut self, needed: usize) { | |
: let mut vec = &mut self.0.bytes; | |
: let cap = vec.capacity(); | |
1 1.0e-05 : if cap == 0 { | |
: let init = cmp::max(INIT_BUFFER_SIZE, needed); | |
: trace!("WriteBuf reserving initial {}", init); | |
: vec.reserve(init); | |
4 4.2e-05 : } else if cap < MAX_BUFFER_SIZE { | |
1 1.0e-05 : vec.reserve(cmp::min(needed, MAX_BUFFER_SIZE - cap)); | |
: trace!("WriteBuf reserved {}", vec.capacity() - cap); | |
: } | |
: } | |
: | |
: fn maybe_reset(&mut self) { | |
1 1.0e-05 : if self.0.pos != 0 && self.0.remaining() == 0 { | |
: self.0.pos = 0; | |
: unsafe { | |
: self.0.bytes.set_len(0); | |
: } | |
: } | |
: } | |
:} | |
: | |
:#[test] | |
:fn test_iobuf_write_empty_slice() { | |
: use mock::{AsyncIo, Buf as MockBuf}; | |
: | |
: let mut mock = AsyncIo::new(MockBuf::new(), 256); | |
: mock.error(io::Error::new(io::ErrorKind::Other, "logic error")); | |
: | |
: let mut io_buf = Buffered::new(mock); | |
: | |
: // underlying io will return the logic error upon write, | |
: // so we are testing that the io_buf does not trigger a write | |
: // when there is nothing to flush | |
: io_buf.flush().expect("should short-circuit flush"); | |
:} | |
/* | |
* Total samples for file : "/checkout/src/libstd/thread/local.rs" | |
* | |
* 11483 0.1206 | |
*/ | |
/* std::rand::thread_rng::THREAD_RNG_KEY::__init::h21903ac62ee9009a total: 1 1.0e-05 */ | |
/* std::collections::hash::map::RandomState::new::KEYS::__getit::h1cf3e2c5cc101827 total: 14 1.5e-04 */ | |
/* | |
* Total samples for file : "EarlyCSE.cpp" | |
* | |
* 10931 0.1148 | |
*/ | |
<credited to line zero> 10931 0.1148 : | |
/* llvm::DenseMap<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*> >::grow(unsigned int) total: 20 2.1e-04 */ | |
/* llvm::DenseMap<(anonymous namespace)::CallValue, llvm::ScopedHashTableVal<(anonymous namespace)::CallValue, std::pair<llvm::Instruction*, unsigned int> >*, llvm::DenseMapInfo<(anonymous namespace)::CallValue>, llvm::detail::DenseMapPair<(anonymous namespace)::CallValue, llvm::ScopedHashTableVal<(anonymous namespace)::CallValue, std::pair<llvm::Instruction*, unsigned int> >*> >::grow(unsigned int) total: 1 1.0e-05 */ | |
/* llvm::DenseMap<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*> >::grow(unsigned int) total: 114 0.0012 */ | |
/* (anonymous namespace)::EarlyCSE::ParseMemoryInst::isLoad() const total: 88 9.2e-04 */ | |
/* initializeEarlyCSELegacyPassPassOnce(llvm::PassRegistry&) total: 1 1.0e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*> >, llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*> >::initEmpty() total: 46 4.8e-04 */ | |
/* (anonymous namespace)::EarlyCSE::ParseMemoryInst::isStore() const total: 25 2.6e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*> >, llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*> >::LookupBucketFor<llvm::Value*>(llvm::Value* const&, llvm::detail::DenseMapPair<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*>*&) total: 27 2.8e-04 */ | |
/* llvm::ScopedHashTable<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue, llvm::DenseMapInfo<llvm::Value*>, llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>, 48ul, 8ul> >::lookup(llvm::Value* const&) total: 117 0.0012 */ | |
/* (anonymous namespace)::EarlyCSE::ParseMemoryInst::ParseMemoryInst(llvm::Instruction*, llvm::TargetTransformInfo const&) total: 290 0.0030 */ | |
/* llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>::isEqual((anonymous namespace)::SimpleValue, (anonymous namespace)::SimpleValue) total: 2099 0.0220 */ | |
/* (anonymous namespace)::EarlyCSE::ParseMemoryInst::isUnordered() const [clone .isra.268] total: 49 5.1e-04 */ | |
/* (anonymous namespace)::EarlyCSE::ParseMemoryInst::isVolatile() const [clone .isra.270] total: 36 3.8e-04 */ | |
/* (anonymous namespace)::EarlyCSE::ParseMemoryInst::getPointerOperand() const [clone .part.286] total: 439 0.0046 */ | |
/* (anonymous namespace)::EarlyCSE::ParseMemoryInst::isMatchingMemLoc((anonymous namespace)::EarlyCSE::ParseMemoryInst const&) const total: 7 7.3e-05 */ | |
/* (anonymous namespace)::EarlyCSE::getOrCreateResult(llvm::Value*, llvm::Type*) const [clone .isra.299] total: 5 5.2e-05 */ | |
/* (anonymous namespace)::SimpleValue::canHandle(llvm::Instruction*) total: 737 0.0077 */ | |
/* (anonymous namespace)::SimpleValue::SimpleValue(llvm::Instruction*) total: 45 4.7e-04 */ | |
/* llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>::getEmptyKey() total: 2 2.1e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*> >, (anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*> >::initEmpty() total: 79 8.3e-04 */ | |
/* llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>::getTombstoneKey() total: 1 1.0e-05 */ | |
/* llvm::ScopedHashTable<(anonymous namespace)::SimpleValue, llvm::Value*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>, 32ul, 8ul> >::~ScopedHashTable() total: 164 0.0017 */ | |
/* (anonymous namespace)::CallValue::canHandle(llvm::Instruction*) [clone .part.310] total: 58 6.1e-04 */ | |
/* (anonymous namespace)::EarlyCSE::EarlyCSE(llvm::TargetLibraryInfo const&, llvm::TargetTransformInfo const&, llvm::DominatorTree&, llvm::AssumptionCache&) total: 86 9.0e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<(anonymous namespace)::CallValue, llvm::ScopedHashTableVal<(anonymous namespace)::CallValue, std::pair<llvm::Instruction*, unsigned int> >*, llvm::DenseMapInfo<(anonymous namespace)::CallValue>, llvm::detail::DenseMapPair<(anonymous namespace)::CallValue, llvm::ScopedHashTableVal<(anonymous namespace)::CallValue, std::pair<llvm::Instruction*, unsigned int> >*> >, (anonymous namespace)::CallValue, llvm::ScopedHashTableVal<(anonymous namespace)::CallValue, std::pair<llvm::Instruction*, unsigned int> >*, llvm::DenseMapInfo<(anonymous namespace)::CallValue>, llvm::detail::DenseMapPair<(anonymous namespace)::CallValue, llvm::ScopedHashTableVal<(anonymous namespace)::CallValue, std::pair<llvm::Instruction*, unsigned int> >*> >::destroyAll() total: 14 1.5e-04 */ | |
/* llvm::DenseMapInfo<(anonymous namespace)::CallValue>::getHashValue((anonymous namespace)::CallValue) total: 2 2.1e-05 */ | |
/* llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>::getHashValue((anonymous namespace)::SimpleValue) total: 1097 0.0115 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*> >, (anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*> >::LookupBucketFor<(anonymous namespace)::SimpleValue>((anonymous namespace)::SimpleValue const&, llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*> const*&) const total: 752 0.0079 */ | |
/* llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*>* llvm::DenseMapBase<llvm::DenseMap<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*> >, (anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*> >::InsertIntoBucketImpl<(anonymous namespace)::SimpleValue>((anonymous namespace)::SimpleValue const&, (anonymous namespace)::SimpleValue const&, llvm::detail::DenseMapPair<(anonymous namespace)::SimpleValue, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>*>*) [clone .isra.313] total: 145 0.0015 */ | |
/* llvm::ScopedHashTableScope<(anonymous namespace)::SimpleValue, llvm::Value*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>, 32ul, 8ul> >::~ScopedHashTableScope() total: 531 0.0056 */ | |
/* llvm::ScopedHashTable<(anonymous namespace)::SimpleValue, llvm::Value*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>, 32ul, 8ul> >::insertIntoScope(llvm::ScopedHashTableScope<(anonymous namespace)::SimpleValue, llvm::Value*, llvm::DenseMapInfo<(anonymous namespace)::SimpleValue>, llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, llvm::ScopedHashTableVal<(anonymous namespace)::SimpleValue, llvm::Value*>, 32ul, 8ul> >*, (anonymous namespace)::SimpleValue const&, llvm::Value* const&) total: 271 0.0028 */ | |
/* llvm::ScopedHashTable<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue, llvm::DenseMapInfo<llvm::Value*>, llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>, 48ul, 8ul> >::insertIntoScope(llvm::ScopedHashTableScope<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue, llvm::DenseMapInfo<llvm::Value*>, llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>, 48ul, 8ul> >*, llvm::Value* const&, (anonymous namespace)::EarlyCSE::LoadValue const&) total: 202 0.0021 */ | |
/* (anonymous namespace)::EarlyCSE::processNode(llvm::DomTreeNodeBase<llvm::BasicBlock>*) total: 2337 0.0245 */ | |
/* (anonymous namespace)::EarlyCSE::run() total: 861 0.0090 */ | |
/* (anonymous namespace)::EarlyCSELegacyPass::runOnFunction(llvm::Function&) [clone .part.350] total: 93 9.8e-04 */ | |
/* (anonymous namespace)::EarlyCSELegacyPass::runOnFunction(llvm::Function&) total: 90 9.4e-04 */ | |
/* | |
* Total samples for file : "InstructionCombining.cpp" | |
* | |
* 10591 0.1112 | |
*/ | |
<credited to line zero> 10591 0.1112 : | |
/* LeftDistributesOverRight(llvm::Instruction::BinaryOps, llvm::Instruction::BinaryOps) total: 39 4.1e-04 */ | |
/* RightDistributesOverLeft(llvm::Instruction::BinaryOps, llvm::Instruction::BinaryOps) total: 41 4.3e-04 */ | |
/* llvm::User::getOperand(unsigned int) const [clone .constprop.767] total: 26 2.7e-04 */ | |
/* getIdentityValue(llvm::Instruction::BinaryOps, llvm::Value*) total: 188 0.0020 */ | |
/* llvm::Twine::Twine(char const*) [clone .constprop.768] total: 8 8.4e-05 */ | |
/* shouldMergeGEPs(llvm::GEPOperator&, llvm::GEPOperator&) total: 14 1.5e-04 */ | |
/* llvm::GetElementPtrInst::Create(llvm::Type*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::Instruction*) [clone .constprop.753] total: 22 2.3e-04 */ | |
/* llvm::getComplexity(llvm::Value*) total: 237 0.0025 */ | |
/* getBinOpsForFactorization(llvm::Instruction::BinaryOps, llvm::BinaryOperator*, llvm::Value*&, llvm::Value*&) total: 175 0.0018 */ | |
/* llvm::InstCombiner::InsertNewInstBefore(llvm::Instruction*, llvm::Instruction&) [clone .isra.411] total: 5 5.2e-05 */ | |
/* ClearSubclassDataAfterReassociation(llvm::BinaryOperator&) total: 1 1.0e-05 */ | |
/* tryFactorization(llvm::IRBuilder<llvm::TargetFolder, llvm::InstCombineIRInserter>*, llvm::DataLayout const&, llvm::BinaryOperator&, llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*) total: 253 0.0027 */ | |
/* FoldOperationIntoSelectOperand(llvm::Instruction&, llvm::Value*, llvm::InstCombiner*) [clone .isra.618] total: 1 1.0e-05 */ | |
/* AddReachableCodeToWorklist(llvm::BasicBlock*, llvm::DataLayout const&, llvm::SmallPtrSetImpl<llvm::BasicBlock*>&, llvm::InstCombineWorklist&, llvm::TargetLibraryInfo const*) total: 8694 0.0913 */ | |
/* combineInstructionsOverFunction(llvm::Function&, llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::DominatorTree&, bool, llvm::LoopInfo*) total: 887 0.0093 */ | |
/* | |
* Total samples for file : "/checkout/src/liballoc_jemalloc/lib.rs" | |
* | |
* 10523 0.1105 | |
*/ | |
/* __rust_allocate total: 2038 0.0214 */ | |
/* __rust_allocate total: 3302 0.0347 */ | |
/* __rust_reallocate total: 1 1.0e-05 */ | |
/* __rust_reallocate total: 5 5.2e-05 */ | |
/* __rust_reallocate total: 462 0.0049 */ | |
/* __rust_reallocate_inplace total: 4 4.2e-05 */ | |
/* __rust_deallocate total: 2258 0.0237 */ | |
/* __rust_deallocate total: 2453 0.0258 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/option.rs" | |
* | |
* 9787 0.1028 | |
*/ | |
/* | |
* Total samples for file : "SCCP.cpp" | |
* | |
* 8531 0.0896 | |
*/ | |
<credited to line zero> 8531 0.0896 : | |
/* llvm::DenseMap<llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >::grow(unsigned int) total: 256 0.0027 */ | |
/* llvm::DenseMap<llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >::grow(unsigned int) total: 3 3.1e-05 */ | |
/* llvm::DenseMap<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Value*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> >::grow(unsigned int) total: 11 1.2e-04 */ | |
/* llvm::DenseMap<std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Function*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal> >::grow(unsigned int) total: 1 1.0e-05 */ | |
/* llvm::DenseMapIterator<llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal>, false>::operator==(llvm::DenseMapIterator<llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal>, true> const&) const total: 8 8.4e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >, llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >::initEmpty() total: 94 9.9e-04 */ | |
/* bool std::none_of<__gnu_cxx::__normal_iterator<(anonymous namespace)::LatticeVal*, std::vector<(anonymous namespace)::LatticeVal, std::allocator<(anonymous namespace)::LatticeVal> > >, tryToReplaceWithConstant((anonymous namespace)::SCCPSolver&, llvm::Value*)::{lambda((anonymous namespace)::LatticeVal&)#1}>(__gnu_cxx::__normal_iterator<(anonymous namespace)::LatticeVal*, std::vector<(anonymous namespace)::LatticeVal, std::allocator<(anonymous namespace)::LatticeVal> > >, tryToReplaceWithConstant((anonymous namespace)::SCCPSolver&, llvm::Value*)::{lambda((anonymous namespace)::LatticeVal&)#1}, tryToReplaceWithConstant((anonymous namespace)::SCCPSolver&, llvm::Value*)::{lambda((anonymous namespace)::LatticeVal&)#1}) total: 6 6.3e-05 */ | |
/* (anonymous namespace)::LatticeVal::getConstant() const total: 14 1.5e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >, llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >::initEmpty() total: 1 1.0e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Value*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> >, std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Value*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> >::initEmpty() total: 12 1.3e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >, llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >::LookupBucketFor<llvm::Function*>(llvm::Function* const&, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> const*&) const total: 52 5.5e-04 */ | |
/* (anonymous namespace)::IPSCCPLegacyPass::~IPSCCPLegacyPass() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::SCCPLegacyPass::~SCCPLegacyPass() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::LatticeVal::LatticeVal() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::SCCPSolver::~SCCPSolver() total: 16 1.7e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >, llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >::end() total: 8 8.4e-05 */ | |
/* (anonymous namespace)::LatticeVal::getConstantInt() const total: 21 2.2e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >, llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >::find(llvm::Function* const&) total: 18 1.9e-04 */ | |
/* (anonymous namespace)::LatticeVal::markConstant(llvm::Constant*) total: 11 1.2e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >, llvm::Function*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Function*>, llvm::detail::DenseMapPair<llvm::Function*, (anonymous namespace)::LatticeVal> >::insert(std::pair<llvm::Function*, (anonymous namespace)::LatticeVal>&&) total: 7 7.3e-05 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >, llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >::LookupBucketFor<llvm::Value*>(llvm::Value* const&, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal>*&) total: 24 2.5e-04 */ | |
/* llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal>* llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >, llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >::InsertIntoBucketImpl<llvm::Value*>(llvm::Value* const&, llvm::Value* const&, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal>*) [clone .isra.435] total: 183 0.0019 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >, llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >::FindAndConstruct(llvm::Value* const&) total: 370 0.0039 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >, llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >::FindAndConstruct(llvm::Value*&&) total: 271 0.0028 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >, llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >::insert(std::pair<llvm::Value*, (anonymous namespace)::LatticeVal>&&) total: 544 0.0057 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >, llvm::Value*, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, (anonymous namespace)::LatticeVal> >::find(llvm::Value* const&) const total: 217 0.0023 */ | |
/* (anonymous namespace)::SCCPSolver::getLatticeValueFor(llvm::Value*) const total: 67 7.0e-04 */ | |
/* (anonymous namespace)::SCCPSolver::getValueState(llvm::Value*) total: 300 0.0031 */ | |
/* (anonymous namespace)::SCCPSolver::isEdgeFeasible(llvm::BasicBlock*, llvm::BasicBlock*) total: 47 4.9e-04 */ | |
/* AddressIsTaken(llvm::GlobalValue const*) total: 9 9.4e-05 */ | |
/* (anonymous namespace)::SCCPSolver::MarkBlockExecutable(llvm::BasicBlock*) total: 55 5.8e-04 */ | |
/* (anonymous namespace)::SCCPSolver::markConstant((anonymous namespace)::LatticeVal&, llvm::Value*, llvm::Constant*) [clone .part.227] total: 8 8.4e-05 */ | |
/* (anonymous namespace)::SCCPSolver::markConstant((anonymous namespace)::LatticeVal&, llvm::Value*, llvm::Constant*) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::SCCPSolver::markConstant(llvm::Value*, llvm::Constant*) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::SCCPSolver::markOverdefined((anonymous namespace)::LatticeVal&, llvm::Value*) total: 97 0.0010 */ | |
/* (anonymous namespace)::SCCPSolver::mergeInValue((anonymous namespace)::LatticeVal&, llvm::Value*, (anonymous namespace)::LatticeVal) total: 47 4.9e-04 */ | |
/* (anonymous namespace)::SCCPSolver::mergeInValue(llvm::Value*, (anonymous namespace)::LatticeVal) total: 26 2.7e-04 */ | |
/* (anonymous namespace)::SCCPSolver::visitStoreInst(llvm::StoreInst&) total: 51 5.4e-04 */ | |
/* (anonymous namespace)::SCCPSolver::markOverdefined(llvm::Value*) total: 131 0.0014 */ | |
/* (anonymous namespace)::SCCPSolver::visitCastInst(llvm::CastInst&) total: 41 4.3e-04 */ | |
/* (anonymous namespace)::SCCPSolver::visitBinaryOperator(llvm::Instruction&) total: 61 6.4e-04 */ | |
/* (anonymous namespace)::SCCPSolver::visitCmpInst(llvm::CmpInst&) total: 69 7.2e-04 */ | |
/* (anonymous namespace)::SCCPSolver::getFeasibleSuccessors(llvm::TerminatorInst&, llvm::SmallVectorImpl<bool>&) total: 93 9.8e-04 */ | |
/* (anonymous namespace)::SCCPSolver::visitGetElementPtrInst(llvm::GetElementPtrInst&) total: 202 0.0021 */ | |
/* (anonymous namespace)::SCCPSolver::SCCPSolver(llvm::DataLayout const&, llvm::TargetLibraryInfo const*) total: 52 5.5e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Value*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> >, std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Value*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> >::LookupBucketFor<std::pair<llvm::Value*, unsigned int> >(std::pair<llvm::Value*, unsigned int> const&, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> const*&) const total: 119 0.0012 */ | |
/* llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal>* llvm::DenseMapBase<llvm::DenseMap<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Value*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> >, std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Value*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> >::InsertIntoBucketImpl<std::pair<llvm::Value*, unsigned int> >(std::pair<llvm::Value*, unsigned int> const&, std::pair<llvm::Value*, unsigned int> const&, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal>*) [clone .isra.433] total: 14 1.5e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Value*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> >, std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Value*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal> >::insert(std::pair<std::pair<llvm::Value*, unsigned int>, (anonymous namespace)::LatticeVal>&&) total: 20 2.1e-04 */ | |
/* (anonymous namespace)::SCCPSolver::getStructValueState(llvm::Value*, unsigned int) total: 38 4.0e-04 */ | |
/* (anonymous namespace)::SCCPSolver::markAnythingOverdefined(llvm::Value*) total: 34 3.6e-04 */ | |
/* (anonymous namespace)::SCCPSolver::visitSelectInst(llvm::SelectInst&) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::SCCPSolver::visitExtractValueInst(llvm::ExtractValueInst&) total: 25 2.6e-04 */ | |
/* (anonymous namespace)::SCCPSolver::visitInsertValueInst(llvm::InsertValueInst&) total: 21 2.2e-04 */ | |
/* (anonymous namespace)::SCCPSolver::visitPHINode(llvm::PHINode&) total: 244 0.0026 */ | |
/* (anonymous namespace)::SCCPSolver::markEdgeExecutable(llvm::BasicBlock*, llvm::BasicBlock*) [clone .part.484] total: 46 4.8e-04 */ | |
/* (anonymous namespace)::SCCPSolver::visitLoadInst(llvm::LoadInst&) total: 60 6.3e-04 */ | |
/* (anonymous namespace)::SCCPSolver::getStructLatticeValueFor(llvm::Value*) const total: 49 5.1e-04 */ | |
/* tryToReplaceWithConstant((anonymous namespace)::SCCPSolver&, llvm::Value*) total: 91 9.6e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Function*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal> >, std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Function*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal> >::LookupBucketFor<std::pair<llvm::Function*, unsigned int> >(std::pair<llvm::Function*, unsigned int> const&, llvm::detail::DenseMapPair<std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal> const*&) const total: 2 2.1e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Function*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal> >, std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal, llvm::DenseMapInfo<std::pair<llvm::Function*, unsigned int> >, llvm::detail::DenseMapPair<std::pair<llvm::Function*, unsigned int>, (anonymous namespace)::LatticeVal> >::FindAndConstruct(std::pair<llvm::Function*, unsigned int>&&) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::SCCPSolver::visitReturnInst(llvm::ReturnInst&) total: 65 6.8e-04 */ | |
/* (anonymous namespace)::SCCPSolver::AddTrackedFunction(llvm::Function*) total: 7 7.3e-05 */ | |
/* (anonymous namespace)::SCCPSolver::visitCallSite(llvm::CallSite) total: 366 0.0038 */ | |
/* (anonymous namespace)::SCCPSolver::visitCallInst(llvm::CallInst&) total: 11 1.2e-04 */ | |
/* llvm::InstVisitor<(anonymous namespace)::SCCPSolver, void>::delegateCallInst(llvm::CallInst&) total: 268 0.0028 */ | |
/* (anonymous namespace)::SCCPSolver::ResolvedUndefsIn(llvm::Function&) total: 996 0.0105 */ | |
/* (anonymous namespace)::SCCPSolver::visitTerminatorInst(llvm::TerminatorInst&) total: 206 0.0022 */ | |
/* (anonymous namespace)::SCCPSolver::visitInvokeInst(llvm::InvokeInst&) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::SCCPSolver::Solve() total: 1547 0.0162 */ | |
/* runIPSCCP(llvm::Module&, llvm::DataLayout const&, llvm::TargetLibraryInfo const*) total: 304 0.0032 */ | |
/* runSCCP(llvm::Function&, llvm::DataLayout const&, llvm::TargetLibraryInfo const*) total: 443 0.0047 */ | |
/* (anonymous namespace)::SCCPLegacyPass::runOnFunction(llvm::Function&) total: 32 3.4e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/cell.rs" | |
* | |
* 8417 0.0884 | |
*/ | |
/* hyper::http::buf::MemBuf::slice::h4cc0880c0218dcda total: 4013 0.0421 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/sync/mpsc/queue.rs" | |
* | |
* 8004 0.0840 | |
*/ | |
:/* Copyright (c) 2010-2011 Dmitry Vyukov. All rights reserved. | |
: * Redistribution and use in source and binary forms, with or without | |
: * modification, are permitted provided that the following conditions are met: | |
: * | |
: * 1. Redistributions of source code must retain the above copyright notice, | |
: * this list of conditions and the following disclaimer. | |
: * | |
: * 2. Redistributions in binary form must reproduce the above copyright | |
: * notice, this list of conditions and the following disclaimer in the | |
: * documentation and/or other materials provided with the distribution. | |
: * | |
: * THIS SOFTWARE IS PROVIDED BY DMITRY VYUKOV "AS IS" AND ANY EXPRESS OR IMPLIED | |
: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | |
: * SHALL DMITRY VYUKOV OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | |
: * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
: * | |
: * The views and conclusions contained in the software and documentation are | |
: * those of the authors and should not be interpreted as representing official | |
: * policies, either expressed or implied, of Dmitry Vyukov. | |
: */ | |
: | |
://! A mostly lock-free multi-producer, single consumer queue. | |
://! | |
://! This module contains an implementation of a concurrent MPSC queue. This | |
://! queue can be used to share data between threads, and is also used as the | |
://! building block of channels in rust. | |
://! | |
://! Note that the current implementation of this queue has a caveat of the `pop` | |
://! method, and see the method for more information about it. Due to this | |
://! caveat, this queue may not be appropriate for all use-cases. | |
: | |
:// http://www.1024cores.net/home/lock-free-algorithms | |
:// /queues/non-intrusive-mpsc-node-based-queue | |
: | |
:// NOTE: this implementation is lifted from the standard library and only | |
:// slightly modified | |
: | |
:pub use self::PopResult::*; | |
:use std::prelude::v1::*; | |
: | |
:use std::cell::UnsafeCell; | |
:use std::ptr; | |
:use std::sync::atomic::{AtomicPtr, Ordering}; | |
: | |
:/// A result of the `pop` function. | |
:pub enum PopResult<T> { | |
: /// Some data has been popped | |
: Data(T), | |
: /// The queue is empty | |
: Empty, | |
: /// The queue is in an inconsistent state. Popping data should succeed, but | |
: /// some pushers have yet to make enough progress in order allow a pop to | |
: /// succeed. It is recommended that a pop() occur "in the near future" in | |
: /// order to see if the sender has made progress or not | |
: Inconsistent, | |
:} | |
: | |
:struct Node<T> { | |
: next: AtomicPtr<Node<T>>, | |
: value: Option<T>, | |
:} | |
: | |
:/// The multi-producer single-consumer structure. This is not cloneable, but it | |
:/// may be safely shared so long as it is guaranteed that there is only one | |
:/// popper at a time (many pushers are allowed). | |
:pub struct Queue<T> { | |
: head: AtomicPtr<Node<T>>, | |
: tail: UnsafeCell<*mut Node<T>>, | |
:} | |
: | |
:unsafe impl<T: Send> Send for Queue<T> { } | |
:unsafe impl<T: Send> Sync for Queue<T> { } | |
: | |
:impl<T> Node<T> { | |
: unsafe fn new(v: Option<T>) -> *mut Node<T> { | |
: Box::into_raw(Box::new(Node { | |
: next: AtomicPtr::new(ptr::null_mut()), | |
: value: v, | |
: })) | |
: } | |
:} | |
: | |
:impl<T> Queue<T> { | |
: /// Creates a new queue that is safe to share among multiple producers and | |
: /// one consumer. | |
: pub fn new() -> Queue<T> { | |
: let stub = unsafe { Node::new(None) }; | |
: Queue { | |
: head: AtomicPtr::new(stub), | |
: tail: UnsafeCell::new(stub), | |
: } | |
: } | |
: | |
: /// Pushes a new value onto this queue. | |
: pub fn push(&self, t: T) { | |
: unsafe { | |
: let n = Node::new(Some(t)); | |
: let prev = self.head.swap(n, Ordering::AcqRel); | |
: (*prev).next.store(n, Ordering::Release); | |
: } | |
: } | |
: | |
: /// Pops some data from this queue. | |
: /// | |
: /// Note that the current implementation means that this function cannot | |
: /// return `Option<T>`. It is possible for this queue to be in an | |
: /// inconsistent state where many pushes have succeeded and completely | |
: /// finished, but pops cannot return `Some(t)`. This inconsistent state | |
: /// happens when a pusher is pre-empted at an inopportune moment. | |
: /// | |
: /// This inconsistent state means that this queue does indeed have data, but | |
: /// it does not currently have access to it at this time. | |
: /// | |
: /// This function is unsafe because only one thread can call it at a time. | |
5951 0.0625 : pub unsafe fn pop(&self) -> PopResult<T> { /* _$LT$futures..sync..mpsc..queue..Queue$LT$T$GT$$GT$::pop::he38abe19be74ebf3 8 8.4e-05, _$LT$futures..sync..mpsc..queue..Queue$LT$T$GT$$GT$::pop::hf2b96c1629fa177f 9770 0.1026, _$LT$futures..sync..mpsc..queue..Queue$LT$T$GT$$GT$::pop::h25b5a30297344642 35 3.7e-04, total: 9813 0.1030 */ | |
638 0.0067 : let tail = *self.tail.get(); | |
: let next = (*tail).next.load(Ordering::Acquire); | |
: | |
1 1.0e-05 : if !next.is_null() { | |
156 0.0016 : *self.tail.get() = next; | |
56 5.9e-04 : assert!((*tail).value.is_none()); | |
: assert!((*next).value.is_some()); | |
61 6.4e-04 : let ret = (*next).value.take().unwrap(); | |
: drop(Box::from_raw(tail)); | |
410 0.0043 : return Data(ret); | |
: } | |
: | |
414 0.0043 : if self.head.load(Ordering::Acquire) == tail {Empty} else {Inconsistent} | |
317 0.0033 : } | |
:} | |
: | |
:impl<T> Drop for Queue<T> { | |
: fn drop(&mut self) { | |
: unsafe { | |
: let mut cur = *self.tail.get(); | |
: while !cur.is_null() { | |
: let next = (*cur).next.load(Ordering::Relaxed); | |
: drop(Box::from_raw(cur)); | |
: cur = next; | |
: } | |
: } | |
: } | |
:} | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/nptl/../nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S" | |
* | |
* 7855 0.0825 | |
*/ | |
/* __libc_enable_asynccancel total: 4551 0.0478 */ | |
/* __libc_disable_asynccancel total: 3304 0.0347 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/future/map_err.rs" | |
* | |
* 7369 0.0774 | |
*/ | |
:use {Future, Poll, Async}; | |
: | |
:/// Future for the `map_err` combinator, changing the error type of a future. | |
:/// | |
:/// This is created by the `Future::map_err` method. | |
:#[must_use = "futures do nothing unless polled"] | |
:pub struct MapErr<A, F> where A: Future { | |
: future: A, | |
: f: Option<F>, | |
:} | |
: | |
:pub fn new<A, F>(future: A, f: F) -> MapErr<A, F> | |
: where A: Future | |
:{ | |
: MapErr { | |
: future: future, | |
: f: Some(f), | |
: } | |
:} | |
: | |
:impl<U, A, F> Future for MapErr<A, F> | |
: where A: Future, | |
: F: FnOnce(A::Error) -> U, | |
:{ | |
: type Item = A::Item; | |
: type Error = U; | |
: | |
635 0.0067 : fn poll(&mut self) -> Poll<A::Item, U> { /* _$LT$futures..future..map_err..MapErr$LT$A$C$$u20$F$GT$$u20$as$u20$futures..future..Future$GT$::poll::h91a27d572e5540c0 total: 9501 0.0998 */ | |
: let e = match self.future.poll() { | |
1989 0.0209 : Ok(Async::NotReady) => return Ok(Async::NotReady), | |
1333 0.0140 : other => other, | |
: }; | |
: e.map_err(self.f.take().expect("cannot poll MapErr twice")) | |
3412 0.0358 : } | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/git/checkouts/hyper-817b53a166fc1c58/499c0d1/src/http/h1/decode.rs" | |
* | |
* 7233 0.0759 | |
*/ | |
:use std::usize; | |
:use std::io; | |
: | |
:use http::buf::MemSlice; | |
:use http::io::MemRead; | |
: | |
:use self::Kind::{Length, Chunked, Eof}; | |
: | |
:/// Decoders to handle different Transfer-Encodings. | |
:/// | |
:/// If a message body does not include a Transfer-Encoding, it *should* | |
:/// include a Content-Length header. | |
:#[derive(Debug, Clone)] | |
:pub struct Decoder { | |
: kind: Kind, | |
:} | |
: | |
:impl Decoder { | |
: pub fn length(x: u64) -> Decoder { | |
: Decoder { kind: Kind::Length(x) } | |
: } | |
: | |
: pub fn chunked() -> Decoder { | |
: Decoder { kind: Kind::Chunked(ChunkedState::Size, 0) } | |
: } | |
: | |
: pub fn eof() -> Decoder { | |
: Decoder { kind: Kind::Eof(false) } | |
: } | |
:} | |
: | |
:#[derive(Debug, Clone)] | |
:enum Kind { | |
: /// A Reader used when a Content-Length header is passed with a positive integer. | |
: Length(u64), | |
: /// A Reader used when Transfer-Encoding is `chunked`. | |
: Chunked(ChunkedState, u64), | |
: /// A Reader used for responses that don't indicate a length or chunked. | |
: /// | |
: /// Note: This should only used for `Response`s. It is illegal for a | |
: /// `Request` to be made with both `Content-Length` and | |
: /// `Transfer-Encoding: chunked` missing, as explained from the spec: | |
: /// | |
: /// > If a Transfer-Encoding header field is present in a response and | |
: /// > the chunked transfer coding is not the final encoding, the | |
: /// > message body length is determined by reading the connection until | |
: /// > it is closed by the server. If a Transfer-Encoding header field | |
: /// > is present in a request and the chunked transfer coding is not | |
: /// > the final encoding, the message body length cannot be determined | |
: /// > reliably; the server MUST respond with the 400 (Bad Request) | |
: /// > status code and then close the connection. | |
: Eof(bool), | |
:} | |
: | |
:#[derive(Debug, PartialEq, Clone)] | |
:enum ChunkedState { | |
: Size, | |
: SizeLws, | |
: Extension, | |
: SizeLf, | |
: Body, | |
: BodyCr, | |
: BodyLf, | |
: EndCr, | |
: EndLf, | |
: End, | |
:} | |
: | |
:impl Decoder { | |
10 1.0e-04 : pub fn is_eof(&self) -> bool { /* hyper::http::h1::decode::Decoder::is_eof::h0da1c14dcb843673 total: 31 3.3e-04 */ | |
: trace!("is_eof? {:?}", self); | |
: match self.kind { | |
18 1.9e-04 : Length(0) | | |
: Chunked(ChunkedState::End, _) | | |
: Eof(true) => true, | |
: _ => false, | |
: } | |
: } | |
:} | |
: | |
:impl Decoder { | |
: pub fn decode<R: MemRead>(&mut self, body: &mut R) -> io::Result<MemSlice> { | |
: match self.kind { | |
2355 0.0247 : Length(ref mut remaining) => { | |
: trace!("Sized read, remaining={:?}", remaining); | |
596 0.0063 : if *remaining == 0 { | |
10 1.0e-04 : Ok(MemSlice::empty()) | |
: } else { | |
: let to_read = *remaining as usize; | |
121 0.0013 : let buf = try!(body.read_mem(to_read)); | |
263 0.0028 : let num = buf.as_ref().len() as u64; | |
: trace!("Length read: {}", num); | |
2419 0.0254 : if num > *remaining { | |
: *remaining = 0; | |
62 6.5e-04 : } else if num == 0 { | |
: return Err(io::Error::new(io::ErrorKind::Other, "early eof")); | |
: } else { | |
227 0.0024 : *remaining -= num; | |
: } | |
1152 0.0121 : Ok(buf) | |
: } | |
: } | |
: Chunked(ref mut state, ref mut size) => { | |
: loop { | |
: let mut buf = None; | |
: // advances the chunked state | |
: *state = try!(state.step(body, size, &mut buf)); | |
: if *state == ChunkedState::End { | |
: trace!("end of chunked"); | |
: return Ok(MemSlice::empty()); | |
: } | |
: if let Some(buf) = buf { | |
: return Ok(buf); | |
: } | |
: } | |
: } | |
: Eof(ref mut is_eof) => { | |
: if *is_eof { | |
: Ok(MemSlice::empty()) | |
: } else { | |
: // 8192 chosen because its about 2 packets, there probably | |
: // won't be that much available, so don't have MemReaders | |
: // allocate buffers to big | |
: match body.read_mem(8192) { | |
: Ok(slice) => { | |
: *is_eof = slice.is_empty(); | |
: Ok(slice) | |
: } | |
: other => other, | |
: } | |
: } | |
: } | |
: } | |
: } | |
:} | |
: | |
:macro_rules! byte ( | |
: ($rdr:ident) => ({ | |
: let buf = try!($rdr.read_mem(1)); | |
: if !buf.is_empty() { | |
: buf[0] | |
: } else { | |
: return Err(io::Error::new(io::ErrorKind::UnexpectedEof, | |
: "Unexpected eof during chunk size line")); | |
: } | |
: }) | |
:); | |
: | |
:impl ChunkedState { | |
: fn step<R: MemRead>(&self, | |
: body: &mut R, | |
: size: &mut u64, | |
: buf: &mut Option<MemSlice>) | |
: -> io::Result<ChunkedState> { | |
: use self::ChunkedState::*; | |
: Ok(match *self { | |
: Size => try!(ChunkedState::read_size(body, size)), | |
: SizeLws => try!(ChunkedState::read_size_lws(body)), | |
: Extension => try!(ChunkedState::read_extension(body)), | |
: SizeLf => try!(ChunkedState::read_size_lf(body, size)), | |
: Body => try!(ChunkedState::read_body(body, size, buf)), | |
: BodyCr => try!(ChunkedState::read_body_cr(body)), | |
: BodyLf => try!(ChunkedState::read_body_lf(body)), | |
: EndCr => try!(ChunkedState::read_end_cr(body)), | |
: EndLf => try!(ChunkedState::read_end_lf(body)), | |
: End => ChunkedState::End, | |
: }) | |
: } | |
: fn read_size<R: MemRead>(rdr: &mut R, size: &mut u64) -> io::Result<ChunkedState> { | |
: trace!("Read chunk hex size"); | |
: let radix = 16; | |
: match byte!(rdr) { | |
: b @ b'0'...b'9' => { | |
: *size *= radix; | |
: *size += (b - b'0') as u64; | |
: } | |
: b @ b'a'...b'f' => { | |
: *size *= radix; | |
: *size += (b + 10 - b'a') as u64; | |
: } | |
: b @ b'A'...b'F' => { | |
: *size *= radix; | |
: *size += (b + 10 - b'A') as u64; | |
: } | |
: b'\t' | b' ' => return Ok(ChunkedState::SizeLws), | |
: b';' => return Ok(ChunkedState::Extension), | |
: b'\r' => return Ok(ChunkedState::SizeLf), | |
: _ => { | |
: return Err(io::Error::new(io::ErrorKind::InvalidInput, | |
: "Invalid chunk size line: Invalid Size")); | |
: } | |
: } | |
: Ok(ChunkedState::Size) | |
: } | |
: fn read_size_lws<R: MemRead>(rdr: &mut R) -> io::Result<ChunkedState> { | |
: trace!("read_size_lws"); | |
: match byte!(rdr) { | |
: // LWS can follow the chunk size, but no more digits can come | |
: b'\t' | b' ' => Ok(ChunkedState::SizeLws), | |
: b';' => Ok(ChunkedState::Extension), | |
: b'\r' => return Ok(ChunkedState::SizeLf), | |
: _ => { | |
: Err(io::Error::new(io::ErrorKind::InvalidInput, | |
: "Invalid chunk size linear white space")) | |
: } | |
: } | |
: } | |
: fn read_extension<R: MemRead>(rdr: &mut R) -> io::Result<ChunkedState> { | |
: trace!("read_extension"); | |
: match byte!(rdr) { | |
: b'\r' => return Ok(ChunkedState::SizeLf), | |
: _ => return Ok(ChunkedState::Extension), // no supported extensions | |
: } | |
: } | |
: fn read_size_lf<R: MemRead>(rdr: &mut R, size: &mut u64) -> io::Result<ChunkedState> { | |
: trace!("Chunk size is {:?}", size); | |
: match byte!(rdr) { | |
: b'\n' if *size > 0 => Ok(ChunkedState::Body), | |
: b'\n' if *size == 0 => Ok(ChunkedState::EndCr), | |
: _ => Err(io::Error::new(io::ErrorKind::InvalidInput, "Invalid chunk size LF")), | |
: } | |
: } | |
: | |
: fn read_body<R: MemRead>(rdr: &mut R, | |
: rem: &mut u64, | |
: buf: &mut Option<MemSlice>) | |
: -> io::Result<ChunkedState> { | |
: trace!("Chunked read, remaining={:?}", rem); | |
: | |
: // cap remaining bytes at the max capacity of usize | |
: let rem_cap = match *rem { | |
: r if r > usize::MAX as u64 => usize::MAX, | |
: r => r as usize, | |
: }; | |
: | |
: let to_read = rem_cap; | |
: let slice = try!(rdr.read_mem(to_read)); | |
: let count = slice.len(); | |
: | |
: if count == 0 { | |
: *rem = 0; | |
: return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "early eof")); | |
: } | |
: *buf = Some(slice); | |
: *rem -= count as u64; | |
: | |
: if *rem > 0 { | |
: Ok(ChunkedState::Body) | |
: } else { | |
: Ok(ChunkedState::BodyCr) | |
: } | |
: } | |
: fn read_body_cr<R: MemRead>(rdr: &mut R) -> io::Result<ChunkedState> { | |
: match byte!(rdr) { | |
: b'\r' => Ok(ChunkedState::BodyLf), | |
: _ => Err(io::Error::new(io::ErrorKind::InvalidInput, "Invalid chunk body CR")), | |
: } | |
: } | |
: fn read_body_lf<R: MemRead>(rdr: &mut R) -> io::Result<ChunkedState> { | |
: match byte!(rdr) { | |
: b'\n' => Ok(ChunkedState::Size), | |
: _ => Err(io::Error::new(io::ErrorKind::InvalidInput, "Invalid chunk body LF")), | |
: } | |
: } | |
: | |
: fn read_end_cr<R: MemRead>(rdr: &mut R) -> io::Result<ChunkedState> { | |
: match byte!(rdr) { | |
: b'\r' => Ok(ChunkedState::EndLf), | |
: _ => Err(io::Error::new(io::ErrorKind::InvalidInput, "Invalid chunk end CR")), | |
: } | |
: } | |
: fn read_end_lf<R: MemRead>(rdr: &mut R) -> io::Result<ChunkedState> { | |
: match byte!(rdr) { | |
: b'\n' => Ok(ChunkedState::End), | |
: _ => Err(io::Error::new(io::ErrorKind::InvalidInput, "Invalid chunk end LF")), | |
: } | |
: } | |
:} | |
: | |
:#[cfg(test)] | |
:mod tests { | |
: use std::error::Error; | |
: use std::io; | |
: use std::io::Write; | |
: use super::Decoder; | |
: use super::ChunkedState; | |
: use http::io::MemRead; | |
: use http::buf::{MemBuf, MemSlice}; | |
: use mock::AsyncIo; | |
: | |
: impl<'a> MemRead for &'a [u8] { | |
: fn read_mem(&mut self, len: usize) -> io::Result<MemSlice> { | |
: let n = ::std::cmp::min(len, self.len()); | |
: if n > 0 { | |
: let mut buf = MemBuf::with_capacity(n); | |
: buf.read_from(self).unwrap(); | |
: Ok(buf.slice(n)) | |
: } else { | |
: Ok(MemSlice::empty()) | |
: } | |
: } | |
: } | |
: | |
: #[test] | |
: fn test_read_chunk_size() { | |
: use std::io::ErrorKind::{UnexpectedEof, InvalidInput}; | |
: | |
: fn read(s: &str) -> u64 { | |
: let mut state = ChunkedState::Size; | |
: let mut rdr = &mut s.as_bytes(); | |
: let mut size = 0; | |
: loop { | |
: let result = state.step(rdr, &mut size, &mut None); | |
: let desc = format!("read_size failed for {:?}", s); | |
: state = result.expect(desc.as_str()); | |
: if state == ChunkedState::Body || state == ChunkedState::EndCr { | |
: break; | |
: } | |
: } | |
: size | |
: } | |
: | |
: fn read_err(s: &str, expected_err: io::ErrorKind) { | |
: let mut state = ChunkedState::Size; | |
: let mut rdr = &mut s.as_bytes(); | |
: let mut size = 0; | |
: loop { | |
: let result = state.step(rdr, &mut size, &mut None); | |
: state = match result { | |
: Ok(s) => s, | |
: Err(e) => { | |
: assert!(expected_err == e.kind(), "Reading {:?}, expected {:?}, but got {:?}", | |
: s, expected_err, e.kind()); | |
: return; | |
: } | |
: }; | |
: if state == ChunkedState::Body || state == ChunkedState::End { | |
: panic!(format!("Was Ok. Expected Err for {:?}", s)); | |
: } | |
: } | |
: } | |
: | |
: assert_eq!(1, read("1\r\n")); | |
: assert_eq!(1, read("01\r\n")); | |
: assert_eq!(0, read("0\r\n")); | |
: assert_eq!(0, read("00\r\n")); | |
: assert_eq!(10, read("A\r\n")); | |
: assert_eq!(10, read("a\r\n")); | |
: assert_eq!(255, read("Ff\r\n")); | |
: assert_eq!(255, read("Ff \r\n")); | |
: // Missing LF or CRLF | |
: read_err("F\rF", InvalidInput); | |
: read_err("F", UnexpectedEof); | |
: // Invalid hex digit | |
: read_err("X\r\n", InvalidInput); | |
: read_err("1X\r\n", InvalidInput); | |
: read_err("-\r\n", InvalidInput); | |
: read_err("-1\r\n", InvalidInput); | |
: // Acceptable (if not fully valid) extensions do not influence the size | |
: assert_eq!(1, read("1;extension\r\n")); | |
: assert_eq!(10, read("a;ext name=value\r\n")); | |
: assert_eq!(1, read("1;extension;extension2\r\n")); | |
: assert_eq!(1, read("1;;; ;\r\n")); | |
: assert_eq!(2, read("2; extension...\r\n")); | |
: assert_eq!(3, read("3 ; extension=123\r\n")); | |
: assert_eq!(3, read("3 ;\r\n")); | |
: assert_eq!(3, read("3 ; \r\n")); | |
: // Invalid extensions cause an error | |
: read_err("1 invalid extension\r\n", InvalidInput); | |
: read_err("1 A\r\n", InvalidInput); | |
: read_err("1;no CRLF", UnexpectedEof); | |
: } | |
: | |
: #[test] | |
: fn test_read_sized_early_eof() { | |
: let mut bytes = &b"foo bar"[..]; | |
: let mut decoder = Decoder::length(10); | |
: assert_eq!(decoder.decode(&mut bytes).unwrap().len(), 7); | |
: let e = decoder.decode(&mut bytes).unwrap_err(); | |
: assert_eq!(e.kind(), io::ErrorKind::Other); | |
: assert_eq!(e.description(), "early eof"); | |
: } | |
: | |
: #[test] | |
: fn test_read_chunked_early_eof() { | |
: let mut bytes = &b"\ | |
: 9\r\n\ | |
: foo bar\ | |
: "[..]; | |
: let mut decoder = Decoder::chunked(); | |
: assert_eq!(decoder.decode(&mut bytes).unwrap().len(), 7); | |
: let e = decoder.decode(&mut bytes).unwrap_err(); | |
: assert_eq!(e.kind(), io::ErrorKind::UnexpectedEof); | |
: assert_eq!(e.description(), "early eof"); | |
: } | |
: | |
: #[test] | |
: fn test_read_chunked_single_read() { | |
: let mut mock_buf = &b"10\r\n1234567890abcdef\r\n0\r\n"[..]; | |
: let buf = Decoder::chunked().decode(&mut mock_buf).expect("decode"); | |
: assert_eq!(16, buf.len()); | |
: let result = String::from_utf8(buf.as_ref().to_vec()).expect("decode String"); | |
: assert_eq!("1234567890abcdef", &result); | |
: } | |
: | |
: #[test] | |
: fn test_read_chunked_after_eof() { | |
: let mut mock_buf = &b"10\r\n1234567890abcdef\r\n0\r\n\r\n"[..]; | |
: let mut decoder = Decoder::chunked(); | |
: | |
: // normal read | |
: let buf = decoder.decode(&mut mock_buf).expect("decode"); | |
: assert_eq!(16, buf.len()); | |
: let result = String::from_utf8(buf.as_ref().to_vec()).expect("decode String"); | |
: assert_eq!("1234567890abcdef", &result); | |
: | |
: // eof read | |
: let buf = decoder.decode(&mut mock_buf).expect("decode"); | |
: assert_eq!(0, buf.len()); | |
: | |
: // ensure read after eof also returns eof | |
: let buf = decoder.decode(&mut mock_buf).expect("decode"); | |
: assert_eq!(0, buf.len()); | |
: } | |
: | |
: // perform an async read using a custom buffer size and causing a blocking | |
: // read at the specified byte | |
: fn read_async(mut decoder: Decoder, | |
: content: &[u8], | |
: block_at: usize) | |
: -> String { | |
: let content_len = content.len(); | |
: let mut ins = AsyncIo::new(content, block_at); | |
: let mut outs = Vec::new(); | |
: loop { | |
: match decoder.decode(&mut ins) { | |
: Ok(buf) => { | |
: if buf.is_empty() { | |
: break; // eof | |
: } | |
: outs.write(buf.as_ref()).expect("write buffer"); | |
: } | |
: Err(e) => match e.kind() { | |
: io::ErrorKind::WouldBlock => { | |
: ins.block_in(content_len); // we only block once | |
: }, | |
: _ => panic!("unexpected decode error: {}", e), | |
: } | |
: }; | |
: } | |
: String::from_utf8(outs).expect("decode String") | |
: } | |
: | |
: // iterate over the different ways that this async read could go. | |
: // tests blocking a read at each byte along the content - The shotgun approach | |
: fn all_async_cases(content: &str, expected: &str, decoder: Decoder) { | |
: let content_len = content.len(); | |
: for block_at in 0..content_len { | |
: let actual = read_async(decoder.clone(), content.as_bytes(), block_at); | |
: assert_eq!(expected, &actual, "Failed async. Blocking at {}", block_at); | |
: } | |
: } | |
: | |
: #[test] | |
: fn test_read_length_async() { | |
: let content = "foobar"; | |
: all_async_cases(content, content, Decoder::length(content.len() as u64)); | |
: } | |
: | |
: #[test] | |
: fn test_read_chunked_async() { | |
: let content = "3\r\nfoo\r\n3\r\nbar\r\n0\r\n\r\n"; | |
: let expected = "foobar"; | |
: all_async_cases(content, expected, Decoder::chunked()); | |
: } | |
: | |
: #[test] | |
: fn test_read_eof_async() { | |
: let content = "foobar"; | |
: all_async_cases(content, content, Decoder::eof()); | |
: } | |
: | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/git/checkouts/hyper-817b53a166fc1c58/499c0d1/src/server/mod.rs" | |
* | |
* 6782 0.0712 | |
*/ | |
://! HTTP Server | |
://! | |
://! A `Server` is created to listen on a port, parse HTTP requests, and hand | |
://! them off to a `Service`. | |
: | |
:use std::cell::RefCell; | |
:use std::fmt; | |
:use std::io; | |
:use std::net::SocketAddr; | |
:use std::rc::{Rc, Weak}; | |
:use std::time::Duration; | |
: | |
:use futures::future; | |
:use futures::task::{self, Task}; | |
:use futures::{Future, Map, Stream, Poll, Async, Sink, StartSend, AsyncSink}; | |
: | |
:use tokio::io::Io; | |
:use tokio::reactor::{Core, Handle, Timeout}; | |
:use tokio::net::TcpListener; | |
:use tokio_proto::BindServer; | |
:use tokio_proto::streaming::Message; | |
:use tokio_proto::streaming::pipeline::{Transport, Frame, ServerProto}; | |
:pub use tokio_service::{NewService, Service}; | |
: | |
:pub use self::request::Request; | |
:pub use self::response::Response; | |
: | |
:use http; | |
: | |
:mod request; | |
:mod response; | |
: | |
:/// An instance of the HTTP protocol, and implementation of tokio-proto's | |
:/// `ServerProto` trait. | |
:/// | |
:/// This structure is used to create instances of `Server` or to spawn off tasks | |
:/// which handle a connection to an HTTP server. Each instance of `Http` can be | |
:/// configured with various protocol-level options such as keepalive. | |
:#[derive(Debug, Clone)] | |
:pub struct Http { | |
: keep_alive: bool, | |
:} | |
: | |
:/// An instance of a server created through `Http::bind`. | |
:/// | |
:/// This server is intended as a convenience for creating a TCP listener on an | |
:/// address and then serving TCP connections accepted with the service provided. | |
:pub struct Server<S> { | |
: protocol: Http, | |
: new_service: S, | |
: core: Core, | |
: listener: TcpListener, | |
: shutdown_timeout: Duration, | |
:} | |
: | |
:impl Http { | |
: /// Creates a new instance of the HTTP protocol, ready to spawn a server or | |
: /// start accepting connections. | |
: pub fn new() -> Http { | |
: Http { | |
: keep_alive: true, | |
: } | |
: } | |
: | |
: /// Enables or disables HTTP keep-alive. | |
: /// | |
: /// Default is true. | |
: pub fn keep_alive(&mut self, val: bool) -> &mut Self { | |
: self.keep_alive = val; | |
: self | |
: } | |
: | |
: /// Bind the provided `addr` and return a server ready to handle | |
: /// connections. | |
: /// | |
: /// This method will bind the `addr` provided with a new TCP listener ready | |
: /// to accept connections. Each connection will be processed with the | |
: /// `new_service` object provided as well, creating a new service per | |
: /// connection. | |
: /// | |
: /// The returned `Server` contains one method, `run`, which is used to | |
: /// actually run the server. | |
: pub fn bind<S>(&self, addr: &SocketAddr, new_service: S) -> ::Result<Server<S>> | |
: where S: NewService<Request = Request, Response = Response, Error = ::Error> + | |
: Send + Sync + 'static, | |
: { | |
: let core = try!(Core::new()); | |
: let handle = core.handle(); | |
: let listener = try!(TcpListener::bind(addr, &handle)); | |
: | |
: Ok(Server { | |
: new_service: new_service, | |
: core: core, | |
: listener: listener, | |
: protocol: self.clone(), | |
: shutdown_timeout: Duration::new(1, 0), | |
: }) | |
: } | |
: | |
: /// Use this `Http` instance to create a new server task which handles the | |
: /// connection `io` provided. | |
: /// | |
: /// This is the low-level method used to actually spawn handling a TCP | |
: /// connection, typically. The `handle` provided is the event loop on which | |
: /// the server task will be spawned, `io` is the I/O object associated with | |
: /// this connection (data that's read/written), `remote_addr` is the remote | |
: /// peer address of the HTTP client, and `service` defines how HTTP requests | |
: /// will be handled (and mapped to responses). | |
: /// | |
: /// This method is typically not invoked directly but is rather transitively | |
: /// used through the `serve` helper method above. This can be useful, | |
: /// however, when writing mocks or accepting sockets from a non-TCP | |
: /// location. | |
: pub fn bind_connection<S, I>(&self, | |
: handle: &Handle, | |
: io: I, | |
: remote_addr: SocketAddr, | |
: service: S) | |
: where S: Service<Request = Request, Response = Response, Error = ::Error> + 'static, | |
: I: Io + 'static, | |
: { | |
: self.bind_server(handle, io, HttpService { | |
: inner: service, | |
: remote_addr: remote_addr, | |
: }) | |
: } | |
:} | |
: | |
:#[doc(hidden)] | |
:#[allow(missing_debug_implementations)] | |
:pub struct ProtoRequest(http::RequestHead); | |
:#[doc(hidden)] | |
:#[allow(missing_debug_implementations)] | |
:pub struct ProtoResponse(ResponseHead); | |
:#[doc(hidden)] | |
:#[allow(missing_debug_implementations)] | |
:pub struct ProtoTransport<T>(http::Conn<T, http::ServerTransaction>); | |
:#[doc(hidden)] | |
:#[allow(missing_debug_implementations)] | |
:pub struct ProtoBindTransport<T> { | |
: inner: future::FutureResult<http::Conn<T, http::ServerTransaction>, io::Error>, | |
:} | |
: | |
:impl<T: Io + 'static> ServerProto<T> for Http { | |
: type Request = ProtoRequest; | |
: type RequestBody = http::Chunk; | |
: type Response = ProtoResponse; | |
: type ResponseBody = http::Chunk; | |
: type Error = ::Error; | |
: type Transport = ProtoTransport<T>; | |
: type BindTransport = ProtoBindTransport<T>; | |
: | |
: fn bind_transport(&self, io: T) -> Self::BindTransport { | |
: let ka = if self.keep_alive { | |
: http::KA::Busy | |
: } else { | |
: http::KA::Disabled | |
: }; | |
: ProtoBindTransport { | |
: inner: future::ok(http::Conn::new(io, ka)), | |
: } | |
: } | |
:} | |
: | |
:impl<T: Io + 'static> Sink for ProtoTransport<T> { | |
: type SinkItem = Frame<ProtoResponse, http::Chunk, ::Error>; | |
: type SinkError = io::Error; | |
: | |
: fn start_send(&mut self, item: Self::SinkItem) | |
: -> StartSend<Self::SinkItem, io::Error> { | |
: let item = match item { | |
2 2.1e-05 : Frame::Message { message, body } => { | |
1 1.0e-05 : Frame::Message { message: message.0, body: body } | |
: } | |
: Frame::Body { chunk } => Frame::Body { chunk: chunk }, | |
: Frame::Error { error } => Frame::Error { error: error }, | |
: }; | |
: match try!(self.0.start_send(item)) { | |
1 1.0e-05 : AsyncSink::Ready => Ok(AsyncSink::Ready), | |
: AsyncSink::NotReady(Frame::Message { message, body }) => { | |
: Ok(AsyncSink::NotReady(Frame::Message { | |
: message: ProtoResponse(message), | |
: body: body, | |
: })) | |
: } | |
: AsyncSink::NotReady(Frame::Body { chunk }) => { | |
: Ok(AsyncSink::NotReady(Frame::Body { chunk: chunk })) | |
: } | |
: AsyncSink::NotReady(Frame::Error { error }) => { | |
: Ok(AsyncSink::NotReady(Frame::Error { error: error })) | |
: } | |
: } | |
1 1.0e-05 : } | |
: | |
: fn poll_complete(&mut self) -> Poll<(), io::Error> { | |
: self.0.poll_complete() | |
: } | |
:} | |
: | |
:impl<T: Io + 'static> Stream for ProtoTransport<T> { | |
: type Item = Frame<ProtoRequest, http::Chunk, ::Error>; | |
: type Error = io::Error; | |
: | |
: fn poll(&mut self) -> Poll<Option<Self::Item>, io::Error> { | |
128 0.0013 : let item = match try_ready!(self.0.poll()) { | |
291 0.0031 : Some(item) => item, | |
: None => return Ok(None.into()), | |
636 0.0067 : }; | |
: let item = match item { | |
1343 0.0141 : Frame::Message { message, body } => { | |
: Frame::Message { message: ProtoRequest(message), body: body } | |
: } | |
546 0.0057 : Frame::Body { chunk } => Frame::Body { chunk: chunk }, | |
260 0.0027 : Frame::Error { error } => Frame::Error { error: error }, | |
: }; | |
1689 0.0177 : Ok(Some(item).into()) | |
1836 0.0193 : } | |
:} | |
: | |
:impl<T: Io + 'static> Transport for ProtoTransport<T> { | |
: fn tick(&mut self) { | |
: self.0.tick() | |
: } | |
: | |
: fn cancel(&mut self) -> io::Result<()> { | |
: self.0.cancel() | |
: } | |
:} | |
: | |
:impl<T: Io + 'static> Future for ProtoBindTransport<T> { | |
: type Item = ProtoTransport<T>; | |
: type Error = io::Error; | |
: | |
: fn poll(&mut self) -> Poll<ProtoTransport<T>, io::Error> { | |
: self.inner.poll().map(|a| a.map(ProtoTransport)) | |
: } | |
:} | |
: | |
:struct HttpService<T> { | |
: inner: T, | |
: remote_addr: SocketAddr, | |
:} | |
: | |
7 7.3e-05 :fn map_response_to_message(res: Response) -> Message<ProtoResponse, http::TokioBody> { /* hyper::server::map_response_to_message::h4d584f90246b6253 total: 23 2.4e-04 */ | |
2 2.1e-05 : let (head, body) = response::split(res); | |
: if let Some(body) = body { | |
: Message::WithBody(ProtoResponse(head), body.into()) | |
: } else { | |
11 1.2e-04 : Message::WithoutBody(ProtoResponse(head)) | |
: } | |
:} | |
: | |
:type ResponseHead = http::MessageHead<::StatusCode>; | |
: | |
:impl<T> Service for HttpService<T> | |
: where T: Service<Request=Request, Response=Response, Error=::Error>, | |
:{ | |
: type Request = Message<ProtoRequest, http::TokioBody>; | |
: type Response = Message<ProtoResponse, http::TokioBody>; | |
: type Error = ::Error; | |
: type Future = Map<T::Future, fn(Response) -> Message<ProtoResponse, http::TokioBody>>; | |
: | |
: fn call(&self, message: Self::Request) -> Self::Future { | |
: let (head, body) = match message { | |
12 1.3e-04 : Message::WithoutBody(head) => (head.0, http::Body::empty()), | |
2 2.1e-05 : Message::WithBody(head, body) => (head.0, body.into()), | |
: }; | |
9 9.4e-05 : let req = request::new(self.remote_addr, head, body); | |
: self.inner.call(req).map(map_response_to_message) | |
5 5.2e-05 : } | |
:} | |
: | |
:impl<S> Server<S> | |
: where S: NewService<Request = Request, Response = Response, Error = ::Error> | |
: + Send + Sync + 'static, | |
:{ | |
: /// Returns the local address that this server is bound to. | |
: pub fn local_addr(&self) -> ::Result<SocketAddr> { | |
: Ok(try!(self.listener.local_addr())) | |
: } | |
: | |
: /// Returns a handle to the underlying event loop that this server will be | |
: /// running on. | |
: pub fn handle(&self) -> Handle { | |
: self.core.handle() | |
: } | |
: | |
: /// Configure the amount of time this server will wait for a "graceful | |
: /// shutdown". | |
: /// | |
: /// This is the amount of time after the shutdown signal is received the | |
: /// server will wait for all pending connections to finish. If the timeout | |
: /// elapses then the server will be forcibly shut down. | |
: /// | |
: /// This defaults to 1s. | |
: pub fn shutdown_timeout(&mut self, timeout: Duration) -> &mut Self { | |
: self.shutdown_timeout = timeout; | |
: self | |
: } | |
: | |
: /// Execute this server infinitely. | |
: /// | |
: /// This method does not currently return, but it will return an error if | |
: /// one occurs. | |
: pub fn run(self) -> ::Result<()> { | |
: self.run_until(future::empty()) | |
: } | |
: | |
: /// Execute this server until the given future, `shutdown_signal`, resolves. | |
: /// | |
: /// This method, like `run` above, is used to execute this HTTP server. The | |
: /// difference with `run`, however, is that this method allows for shutdown | |
: /// in a graceful fashion. The future provided is interpreted as a signal to | |
: /// shut down the server when it resolves. | |
: /// | |
: /// This method will block the current thread executing the HTTP server. | |
: /// When the `shutdown_signal` has resolved then the TCP listener will be | |
: /// unbound (dropped). The thread will continue to block for a maximum of | |
: /// `shutdown_timeout` time waiting for active connections to shut down. | |
: /// Once the `shutdown_timeout` elapses or all active connections are | |
: /// cleaned out then this method will return. | |
: pub fn run_until<F>(self, shutdown_signal: F) -> ::Result<()> | |
: where F: Future<Item = (), Error = ::Error>, | |
: { | |
: let Server { protocol, new_service, mut core, listener, shutdown_timeout } = self; | |
: let handle = core.handle(); | |
: | |
: // Mini future to track the number of active services | |
: let info = Rc::new(RefCell::new(Info { | |
: active: 0, | |
: blocker: None, | |
: })); | |
: | |
: // Future for our server's execution | |
: let srv = listener.incoming().for_each(|(socket, addr)| { | |
: let s = NotifyService { | |
: inner: try!(new_service.new_service()), | |
: info: Rc::downgrade(&info), | |
: }; | |
: info.borrow_mut().active += 1; | |
: protocol.bind_connection(&handle, socket, addr, s); | |
: Ok(()) | |
: }); | |
: | |
: // Main execution of the server. Here we use `select` to wait for either | |
: // `incoming` or `f` to resolve. We know that `incoming` will never | |
: // resolve with a success (it's infinite) so we're actually just waiting | |
: // for an error or for `f`, our shutdown signal. | |
: // | |
: // When we get a shutdown signal (`Ok`) then we drop the TCP listener to | |
: // stop accepting incoming connections. | |
: match core.run(shutdown_signal.select(srv.map_err(|e| e.into()))) { | |
: Ok(((), _incoming)) => {} | |
: Err((e, _other)) => return Err(e), | |
: } | |
: | |
: // Ok we've stopped accepting new connections at this point, but we want | |
: // to give existing connections a chance to clear themselves out. Wait | |
: // at most `shutdown_timeout` time before we just return clearing | |
: // everything out. | |
: // | |
: // Our custom `WaitUntilZero` will resolve once all services constructed | |
: // here have been destroyed. | |
: let timeout = try!(Timeout::new(shutdown_timeout, &handle)); | |
: let wait = WaitUntilZero { info: info.clone() }; | |
: match core.run(wait.select(timeout)) { | |
: Ok(_) => Ok(()), | |
: Err((e, _)) => return Err(e.into()) | |
: } | |
: } | |
:} | |
: | |
:impl<S: fmt::Debug> fmt::Debug for Server<S> { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: f.debug_struct("Server") | |
: .field("core", &"...") | |
: .field("listener", &self.listener) | |
: .field("new_service", &self.new_service) | |
: .field("protocol", &self.protocol) | |
: .finish() | |
: } | |
:} | |
: | |
:struct NotifyService<S> { | |
: inner: S, | |
: info: Weak<RefCell<Info>>, | |
:} | |
: | |
:struct WaitUntilZero { | |
: info: Rc<RefCell<Info>>, | |
:} | |
: | |
:struct Info { | |
: active: usize, | |
: blocker: Option<Task>, | |
:} | |
: | |
:impl<S: Service> Service for NotifyService<S> { | |
: type Request = S::Request; | |
: type Response = S::Response; | |
: type Error = S::Error; | |
: type Future = S::Future; | |
: | |
: fn call(&self, message: Self::Request) -> Self::Future { | |
: self.inner.call(message) | |
: } | |
:} | |
: | |
:impl<S> Drop for NotifyService<S> { | |
: fn drop(&mut self) { | |
: let info = match self.info.upgrade() { | |
: Some(info) => info, | |
: None => return, | |
: }; | |
: let mut info = info.borrow_mut(); | |
: info.active -= 1; | |
: if info.active == 0 { | |
: if let Some(task) = info.blocker.take() { | |
: task.unpark(); | |
: } | |
: } | |
: } | |
:} | |
: | |
:impl Future for WaitUntilZero { | |
: type Item = (); | |
: type Error = io::Error; | |
: | |
: fn poll(&mut self) -> Poll<(), io::Error> { | |
: let mut info = self.info.borrow_mut(); | |
: if info.active == 0 { | |
: Ok(().into()) | |
: } else { | |
: info.blocker = Some(task::park()); | |
: Ok(Async::NotReady) | |
: } | |
: } | |
:} | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/rt/../sysdeps/unix/clock_gettime.c" | |
* | |
* 6496 0.0682 | |
*/ | |
/* clock_gettime total: 6496 0.0682 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/panicking.rs" | |
* | |
* 6356 0.0667 | |
*/ | |
/* std::panicking::try::do_call::h91293149a81f192e total: 3962 0.0416 */ | |
/* std::panicking::panicking::h980a8c40e2dfa454 total: 15172 0.1593 */ | |
/* std::panicking::panicking::h980a8c40e2dfa454 total: 2 2.1e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/sys/unix/mutex.rs" | |
* | |
* 5835 0.0613 | |
*/ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/stream/for_each.rs" | |
* | |
* 5816 0.0611 | |
*/ | |
:use {Async, Future, IntoFuture, Poll}; | |
:use stream::Stream; | |
: | |
:/// A stream combinator which executes a unit closure over each item on a | |
:/// stream. | |
:/// | |
:/// This structure is returned by the `Stream::for_each` method. | |
:#[must_use = "streams do nothing unless polled"] | |
:pub struct ForEach<S, F, U> where U: IntoFuture { | |
: stream: S, | |
: f: F, | |
: fut: Option<U::Future>, | |
:} | |
: | |
:pub fn new<S, F, U>(s: S, f: F) -> ForEach<S, F, U> | |
: where S: Stream, | |
: F: FnMut(S::Item) -> U, | |
: U: IntoFuture<Item = (), Error = S::Error>, | |
:{ | |
: ForEach { | |
: stream: s, | |
: f: f, | |
: fut: None, | |
: } | |
:} | |
: | |
:impl<S, F, U> Future for ForEach<S, F, U> | |
: where S: Stream, | |
: F: FnMut(S::Item) -> U, | |
: U: IntoFuture<Item= (), Error = S::Error>, | |
:{ | |
: type Item = (); | |
: type Error = S::Error; | |
: | |
: fn poll(&mut self) -> Poll<(), S::Error> { | |
: loop { | |
72 7.6e-04 : if let Some(mut fut) = self.fut.take() { | |
: if try!(fut.poll()).is_not_ready() { | |
: self.fut = Some(fut); | |
: return Ok(Async::NotReady); | |
: } | |
: } | |
: | |
1213 0.0127 : match try_ready!(self.stream.poll()) { | |
3897 0.0409 : Some(e) => self.fut = Some((self.f)(e).into_future()), | |
: None => return Ok(Async::Ready(())), | |
: } | |
634 0.0067 : } | |
: } | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-proto-0.1.0/src/streaming/pipeline/server.rs" | |
* | |
* 5784 0.0607 | |
*/ | |
:use BindServer; | |
:use futures::stream::Stream; | |
:use futures::{Future, IntoFuture, Poll, Async}; | |
:use std::collections::VecDeque; | |
:use std::io; | |
:use streaming::{Message, Body}; | |
:use super::advanced::{Pipeline, PipelineMessage}; | |
:use super::{Frame, Transport}; | |
:use tokio_core::reactor::Handle; | |
:use tokio_service::Service; | |
: | |
:// TODO: | |
:// | |
:// - Wait for service readiness | |
:// - Handle request body stream cancellation | |
: | |
:/// A streaming, pipelined server protocol. | |
:/// | |
:/// The `T` parameter is used for the I/O object used to communicate, which is | |
:/// supplied in `bind_transport`. | |
:/// | |
:/// For simple protocols, the `Self` type is often a unit struct. In more | |
:/// advanced cases, `Self` may contain configuration information that is used | |
:/// for setting up the transport in `bind_transport`. | |
:pub trait ServerProto<T: 'static>: 'static { | |
: /// Request headers. | |
: type Request: 'static; | |
: | |
: /// Request body chunks. | |
: type RequestBody: 'static; | |
: | |
: /// Response headers. | |
: type Response: 'static; | |
: | |
: /// Response body chunks. | |
: type ResponseBody: 'static; | |
: | |
: /// Errors, which are used both for error frames and for the service itself. | |
: type Error: From<io::Error> + 'static; | |
: | |
: /// The frame transport, which usually take `T` as a parameter. | |
: type Transport: | |
: Transport<Item = Frame<Self::Request, Self::RequestBody, Self::Error>, | |
: SinkItem = Frame<Self::Response, Self::ResponseBody, Self::Error>>; | |
: | |
: /// A future for initializing a transport from an I/O object. | |
: /// | |
: /// In simple cases, `Result<Self::Transport, Self::Error>` often suffices. | |
: type BindTransport: IntoFuture<Item = Self::Transport, Error = io::Error>; | |
: | |
: /// Build a transport from the given I/O object, using `self` for any | |
: /// configuration. | |
: fn bind_transport(&self, io: T) -> Self::BindTransport; | |
:} | |
: | |
:impl<P, T, B> BindServer<super::StreamingPipeline<B>, T> for P where | |
: P: ServerProto<T>, | |
: T: 'static, | |
: B: Stream<Item = P::ResponseBody, Error = P::Error>, | |
:{ | |
: type ServiceRequest = Message<P::Request, Body<P::RequestBody, P::Error>>; | |
: type ServiceResponse = Message<P::Response, B>; | |
: type ServiceError = P::Error; | |
: | |
: fn bind_server<S>(&self, handle: &Handle, io: T, service: S) | |
: where S: Service<Request = Self::ServiceRequest, | |
: Response = Self::ServiceResponse, | |
: Error = Self::ServiceError> + 'static | |
: { | |
: let task = self.bind_transport(io).into_future().and_then(|transport| { | |
: let dispatch: Dispatch<S, T, P> = Dispatch { | |
: service: service, | |
: transport: transport, | |
: in_flight: VecDeque::with_capacity(32), | |
: }; | |
: Pipeline::new(dispatch) | |
: }); | |
: | |
: // Spawn the pipeline dispatcher | |
: handle.spawn(task.map_err(|_| ())) | |
: } | |
:} | |
: | |
:struct Dispatch<S, T, P> where | |
: T: 'static, P: ServerProto<T>, S: Service | |
:{ | |
: // The service handling the connection | |
: service: S, | |
: transport: P::Transport, | |
: in_flight: VecDeque<InFlight<S::Future>>, | |
:} | |
: | |
:enum InFlight<F: Future> { | |
: Active(F), | |
: Done(Result<F::Item, F::Error>), | |
:} | |
: | |
:impl<P, T, B, S> super::advanced::Dispatch for Dispatch<S, T, P> where | |
: P: ServerProto<T>, | |
: T: 'static, | |
: B: Stream<Item = P::ResponseBody, Error = P::Error>, | |
: S: Service<Request = Message<P::Request, Body<P::RequestBody, P::Error>>, | |
: Response = Message<P::Response, B>, | |
: Error = P::Error>, | |
:{ | |
: type Io = T; | |
: type In = P::Response; | |
: type BodyIn = P::ResponseBody; | |
: type Out = P::Request; | |
: type BodyOut = P::RequestBody; | |
: type Error = P::Error; | |
: type Stream = B; | |
: type Transport = P::Transport; | |
: | |
: fn transport(&mut self) -> &mut P::Transport { | |
424 0.0045 : &mut self.transport | |
: } | |
: | |
23 2.4e-04 : fn dispatch(&mut self, /* _$LT$tokio_proto..streaming..pipeline..server..Dispatch$LT$S$C$$u20$T$C$$u20$P$GT$$u20$as$u20$tokio_proto..streaming..pipeline..advanced..Dispatch$GT$::dispatch::h5ffd10b36076c938 total: 227 0.0024 */ | |
: request: PipelineMessage<Self::Out, Body<Self::BodyOut, Self::Error>, Self::Error>) | |
: -> io::Result<()> | |
: { | |
2 2.1e-05 : if let Ok(request) = request { | |
: let response = self.service.call(request); | |
15 1.6e-04 : self.in_flight.push_back(InFlight::Active(response)); | |
: } | |
: | |
: // TODO: Should the error be handled differently? | |
: | |
3 3.1e-05 : Ok(()) | |
5 5.2e-05 : } | |
: | |
: fn poll(&mut self) -> Poll<Option<PipelineMessage<Self::In, Self::Stream, Self::Error>>, io::Error> { | |
165 0.0017 : for slot in self.in_flight.iter_mut() { | |
: slot.poll(); | |
: } | |
: | |
1843 0.0194 : match self.in_flight.front() { | |
1415 0.0149 : Some(&InFlight::Done(_)) => {} | |
: _ => return Ok(Async::NotReady) | |
: } | |
: | |
466 0.0049 : match self.in_flight.pop_front() { | |
2 2.1e-05 : Some(InFlight::Done(res)) => Ok(Async::Ready(Some(res))), | |
: _ => panic!(), | |
: } | |
: } | |
: | |
: fn has_in_flight(&self) -> bool { | |
: !self.in_flight.is_empty() | |
: } | |
:} | |
: | |
:impl<F: Future> InFlight<F> { | |
: fn poll(&mut self) { | |
: let res = match *self { | |
1252 0.0131 : InFlight::Active(ref mut f) => { | |
157 0.0016 : match f.poll() { | |
: Ok(Async::Ready(e)) => Ok(e), | |
: Err(e) => Err(e), | |
: Ok(Async::NotReady) => return, | |
: } | |
: } | |
: _ => return, | |
: }; | |
12 1.3e-04 : *self = InFlight::Done(res); | |
: } | |
:} | |
/* | |
* Total samples for file : "ValueMapper.cpp" | |
* | |
* 5753 0.0604 | |
*/ | |
<credited to line zero> 5753 0.0604 : | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::DelayedBasicBlock, false>::destroy_range((anonymous namespace)::DelayedBasicBlock*, (anonymous namespace)::DelayedBasicBlock*) total: 131 0.0014 */ | |
/* (anonymous namespace)::Mapper::getVM() total: 128 0.0013 */ | |
/* (anonymous namespace)::Mapper::~Mapper() total: 350 0.0037 */ | |
/* (anonymous namespace)::Mapper::Mapper(llvm::ValueMap<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >&, llvm::RemapFlags, llvm::ValueMapTypeRemapper*, llvm::ValueMaterializer*) total: 351 0.0037 */ | |
/* llvm::ValueMap<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >::operator[](llvm::Value const* const&) [clone .isra.327] total: 141 0.0015 */ | |
/* (anonymous namespace)::Mapper::mapValue(llvm::Value const*) total: 2104 0.0221 */ | |
/* (anonymous namespace)::Mapper::mapSimpleMetadata(llvm::Metadata const*) total: 185 0.0019 */ | |
/* (anonymous namespace)::Mapper::mapMetadata(llvm::Metadata const*) total: 215 0.0023 */ | |
/* (anonymous namespace)::Mapper::remapInstruction(llvm::Instruction*) total: 1852 0.0194 */ | |
/* (anonymous namespace)::Mapper::flush() total: 296 0.0031 */ | |
/* | |
* Total samples for file : "DAGCombiner.cpp" | |
* | |
* 5722 0.0601 | |
*/ | |
<credited to line zero> 5722 0.0601 : | |
/* (anonymous namespace)::DAGCombiner::MatchRotateHalf(llvm::SDValue, llvm::SDValue&, llvm::SDValue&) [clone .isra.120] total: 5 5.2e-05 */ | |
/* (anonymous namespace)::DAGCombiner::MatchBSwapHWordLow(llvm::SDNode*, llvm::SDValue, llvm::SDValue, bool) [clone .isra.448] total: 18 1.9e-04 */ | |
/* (anonymous namespace)::DAGCombiner::MergeStoresOfConstantsOrVecElts(llvm::SmallVectorImpl<(anonymous namespace)::DAGCombiner::MemOpLink>&, llvm::EVT, unsigned int, bool, bool) total: 3 3.1e-05 */ | |
/* void std::__insertion_sort<(anonymous namespace)::DAGCombiner::MemOpLink*, (anonymous namespace)::DAGCombiner::MergeConsecutiveStores(llvm::StoreSDNode*)::{lambda((anonymous namespace)::DAGCombiner::MemOpLink, (anonymous namespace)::DAGCombiner::MemOpLink)#1}>((anonymous namespace)::DAGCombiner::MemOpLink*, (anonymous namespace)::DAGCombiner::MergeConsecutiveStores(llvm::StoreSDNode*)::{lambda((anonymous namespace)::DAGCombiner::MemOpLink, (anonymous namespace)::DAGCombiner::MemOpLink)#1}, (anonymous namespace)::DAGCombiner::MergeConsecutiveStores(llvm::StoreSDNode*)::{lambda((anonymous namespace)::DAGCombiner::MemOpLink, (anonymous namespace)::DAGCombiner::MemOpLink)#1}) total: 2 2.1e-05 */ | |
/* llvm::SDValue::hasOneUse() const [clone .isra.126] total: 4 4.2e-05 */ | |
/* llvm::SDValue::SDValue(llvm::SDNode*, unsigned int) [clone .constprop.583] total: 8 8.4e-05 */ | |
/* llvm::SDValue::SDValue(llvm::SDNode*, unsigned int) [clone .constprop.584] total: 98 0.0010 */ | |
/* llvm::SDValue::getOperand(unsigned int) const [clone .isra.119] [clone .constprop.598] total: 2 2.1e-05 */ | |
/* llvm::SDValue::getOperand(unsigned int) const [clone .isra.119] [clone .constprop.597] total: 2 2.1e-05 */ | |
/* llvm::SDValue::getOperand(unsigned int) const [clone .isra.119] total: 1 1.0e-05 */ | |
/* llvm::SDValue::getValueType() const [clone .isra.117] total: 4 4.2e-05 */ | |
/* (anonymous namespace)::WorklistRemover::~WorklistRemover() total: 1 1.0e-05 */ | |
/* llvm::SDValue::getValue(unsigned int) const [clone .isra.113] [clone .constprop.582] total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::getShiftAmountTy(llvm::EVT) total: 1 1.0e-05 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.591] total: 12 1.3e-04 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.590] total: 31 3.3e-04 */ | |
/* getAsNonOpaqueConstant(llvm::SDValue) total: 34 3.6e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitSETCC(llvm::SDNode*) total: 64 6.7e-04 */ | |
/* getInputChainForNode(llvm::SDNode*) total: 36 3.8e-04 */ | |
/* (anonymous namespace)::LoadedSlice::getUsedBits() const total: 2 2.1e-05 */ | |
/* void std::__insertion_sort<(anonymous namespace)::LoadedSlice*, adjustCostForPairing(llvm::SmallVectorImpl<(anonymous namespace)::LoadedSlice>&, (anonymous namespace)::LoadedSlice::Cost&)::{lambda((anonymous namespace)::LoadedSlice const&, (anonymous namespace)::LoadedSlice const&)#1}>((anonymous namespace)::LoadedSlice*, adjustCostForPairing(llvm::SmallVectorImpl<(anonymous namespace)::LoadedSlice>&, (anonymous namespace)::LoadedSlice::Cost&)::{lambda((anonymous namespace)::LoadedSlice const&, (anonymous namespace)::LoadedSlice const&)#1}, adjustCostForPairing(llvm::SmallVectorImpl<(anonymous namespace)::LoadedSlice>&, (anonymous namespace)::LoadedSlice::Cost&)::{lambda((anonymous namespace)::LoadedSlice const&, (anonymous namespace)::LoadedSlice const&)#1}) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::isSetCCEquivalent(llvm::SDValue, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&) const [clone .isra.175] total: 30 3.1e-04 */ | |
/* (anonymous namespace)::DAGCombiner::removeFromWorklist(llvm::SDNode*) total: 82 8.6e-04 */ | |
/* isConstOrConstSplat(llvm::SDValue) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitRotate(llvm::SDNode*) total: 1 1.0e-05 */ | |
/* isConstOrConstSplatFP(llvm::SDValue) total: 2 2.1e-05 */ | |
/* isBSwapHWordElement(llvm::SDValue, llvm::MutableArrayRef<llvm::SDNode*>) [clone .isra.449] total: 2 2.1e-05 */ | |
/* (anonymous namespace)::DAGCombiner::GetDemandedBits(llvm::SDValue, llvm::APInt const&) [clone .isra.457] total: 23 2.4e-04 */ | |
/* tryToFoldExtendOfConstant(llvm::SDNode*, llvm::TargetLowering const&, llvm::SelectionDAG&, bool, bool) total: 14 1.5e-04 */ | |
/* ExtendUsesToFormExtLoad(llvm::SDNode*, llvm::SDValue, unsigned int, llvm::SmallVectorImpl<llvm::SDNode*>&, llvm::TargetLowering const&) [clone .isra.513] total: 2 2.1e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitShiftByConstant(llvm::SDNode*, llvm::ConstantSDNode*) [clone .isra.452] total: 11 1.2e-04 */ | |
/* (anonymous namespace)::BaseIndexOffset::match(llvm::SDValue, llvm::SelectionDAG&) total: 8 8.4e-05 */ | |
/* (anonymous namespace)::DAGCombiner::AddToWorklist(llvm::SDNode*) total: 31 3.3e-04 */ | |
/* (anonymous namespace)::DAGCombiner::ReassociateOps(unsigned int, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue) total: 117 0.0012 */ | |
/* (anonymous namespace)::DAGCombiner::ReduceLoadOpStoreWidth(llvm::SDNode*) total: 79 8.3e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitBUILD_VECTOR(llvm::SDNode*) total: 11 1.2e-04 */ | |
/* (anonymous namespace)::DAGCombiner::recursivelyDeleteUnusedNodes(llvm::SDNode*) total: 327 0.0034 */ | |
/* (anonymous namespace)::DAGCombiner::ReduceLoadWidth(llvm::SDNode*) total: 36 3.8e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitORLike(llvm::SDValue, llvm::SDValue, llvm::SDNode*) [clone .isra.511] total: 15 1.6e-04 */ | |
/* (anonymous namespace)::DAGCombiner::SimplifySelectCC(llvm::SDLoc const&, llvm::SDValue, llvm::SDValue, llvm::SDValue, llvm::SDValue, llvm::ISD::CondCode, bool) total: 10 1.0e-04 */ | |
/* (anonymous namespace)::DAGCombiner::deleteAndRecombine(llvm::SDNode*) total: 36 3.8e-04 */ | |
/* (anonymous namespace)::DAGCombiner::CombineToPreIndexedLoadStore(llvm::SDNode*) [clone .part.486] total: 60 6.3e-04 */ | |
/* (anonymous namespace)::DAGCombiner::CombineToPostIndexedLoadStore(llvm::SDNode*) [clone .part.487] total: 61 6.4e-04 */ | |
/* (anonymous namespace)::DAGCombiner::PromoteOperand(llvm::SDValue, llvm::EVT, bool&) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitBITCAST(llvm::SDNode*) total: 25 2.6e-04 */ | |
/* (anonymous namespace)::DAGCombiner::CombineTo(llvm::SDNode*, llvm::SDValue const*, unsigned int, bool) [clone .constprop.575] total: 15 1.6e-04 */ | |
/* (anonymous namespace)::DAGCombiner::MergeConsecutiveStores(llvm::StoreSDNode*) total: 82 8.6e-04 */ | |
/* (anonymous namespace)::DAGCombiner::ExtendSetCCUses(llvm::SmallVectorImpl<llvm::SDNode*> const&, llvm::SDValue, llvm::SDValue, llvm::SDLoc const&, llvm::ISD::NodeType) [clone .isra.488] total: 4 4.2e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitANDLike(llvm::SDValue, llvm::SDValue, llvm::SDNode*) [clone .isra.510] total: 69 7.2e-04 */ | |
/* (anonymous namespace)::DAGCombiner::useDivRem(llvm::SDNode*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::CombineTo(llvm::SDNode*, llvm::SDValue const*, unsigned int, bool) total: 19 2.0e-04 */ | |
/* (anonymous namespace)::DAGCombiner::CombineTo(llvm::SDNode*, llvm::SDValue, llvm::SDValue, bool) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::SimplifySelectOps(llvm::SDNode*, llvm::SDValue, llvm::SDValue) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitSELECT(llvm::SDNode*) total: 22 2.3e-04 */ | |
/* (anonymous namespace)::DAGCombiner::CombineExtLoad(llvm::SDNode*) total: 8 8.4e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitSIGN_EXTEND(llvm::SDNode*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitZERO_EXTEND(llvm::SDNode*) total: 48 5.0e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitANY_EXTEND(llvm::SDNode*) total: 10 1.0e-04 */ | |
/* (anonymous namespace)::DAGCombiner::AddUsersToWorklist(llvm::SDNode*) total: 72 7.6e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitMERGE_VALUES(llvm::SDNode*) total: 16 1.7e-04 */ | |
/* (anonymous namespace)::DAGCombiner::SimplifyVBinOp(llvm::SDNode*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitMUL(llvm::SDNode*) total: 13 1.4e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitUDIV(llvm::SDNode*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitSUB(llvm::SDNode*) total: 7 7.3e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitFADD(llvm::SDNode*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitFMUL(llvm::SDNode*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::CommitTargetLoweringOpt(llvm::TargetLowering::TargetLoweringOpt const&) total: 22 2.3e-04 */ | |
/* (anonymous namespace)::DAGCombiner::SimplifyDemandedBits(llvm::SDValue, llvm::APInt const&) total: 121 0.0013 */ | |
/* (anonymous namespace)::DAGCombiner::SimplifyDemandedBits(llvm::SDValue) total: 144 0.0015 */ | |
/* (anonymous namespace)::DAGCombiner::visitSRA(llvm::SDNode*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitADD(llvm::SDNode*) total: 333 0.0035 */ | |
/* (anonymous namespace)::DAGCombiner::visitSRL(llvm::SDNode*) total: 11 1.2e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitSIGN_EXTEND_INREG(llvm::SDNode*) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitSHL(llvm::SDNode*) total: 34 3.6e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitAND(llvm::SDNode*) total: 168 0.0018 */ | |
/* (anonymous namespace)::DAGCombiner::visitXOR(llvm::SDNode*) total: 74 7.8e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitOR(llvm::SDNode*) total: 44 4.6e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitTRUNCATE(llvm::SDNode*) total: 65 6.8e-04 */ | |
/* (anonymous namespace)::DAGCombiner::visitEXTRACT_VECTOR_ELT(llvm::SDNode*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::DAGCombiner::visitLOAD(llvm::SDNode*) total: 293 0.0031 */ | |
/* (anonymous namespace)::DAGCombiner::visitSTORE(llvm::SDNode*) total: 203 0.0021 */ | |
/* (anonymous namespace)::DAGCombiner::visitBRCOND(llvm::SDNode*) total: 132 0.0014 */ | |
/* (anonymous namespace)::DAGCombiner::visitTokenFactor(llvm::SDNode*) total: 276 0.0029 */ | |
/* (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*) total: 882 0.0093 */ | |
/* (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) total: 1207 0.0127 */ | |
/* | |
* Total samples for file : "InlineFunction.cpp" | |
* | |
* 5696 0.0598 | |
*/ | |
<credited to line zero> 5696 0.0598 : | |
/* __gnu_cxx::__exchange_and_add_dispatch(int*, int) [clone .constprop.741] total: 41 4.3e-04 */ | |
/* llvm::Instruction::getMetadata(unsigned int) const [clone .constprop.737] total: 14 1.5e-04 */ | |
/* llvm::Instruction::getMetadata(unsigned int) const [clone .constprop.738] total: 35 3.7e-04 */ | |
/* llvm::DenseMapIterator<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >, llvm::WeakVH, llvm::DenseMapInfo<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > > >, llvm::detail::DenseMapPair<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >, llvm::WeakVH>, false>::AdvancePastEmptyBuckets() [clone .isra.478] total: 414 0.0043 */ | |
/* isUsedByLifetimeMarker(llvm::Value*) total: 7 7.3e-05 */ | |
/* allocaWouldBeStaticInEntry(llvm::AllocaInst const*) total: 2 2.1e-05 */ | |
/* PropagateParallelLoopAccessMetadata(llvm::CallSite, llvm::ValueMap<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >&) total: 31 3.3e-04 */ | |
/* AddAliasScopeMetadata(llvm::CallSite, llvm::ValueMap<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >&, llvm::DataLayout const&, llvm::AAResults*) total: 1521 0.0160 */ | |
/* UpdateCallGraphAfterInlining(llvm::CallSite, llvm::ilist_iterator<llvm::BasicBlock>, llvm::ValueMap<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >&, llvm::InlineFunctionInfo&) [clone .isra.695] total: 184 0.0019 */ | |
/* fixupLineNumbers(llvm::Function*, llvm::ilist_iterator<llvm::BasicBlock>, llvm::Instruction*) total: 1283 0.0135 */ | |
/* CloneAliasScopeMetadata(llvm::CallSite, llvm::ValueMap<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >&) total: 1997 0.0210 */ | |
/* HandleCallsInBlockInlinedThroughInvoke(llvm::BasicBlock*, llvm::BasicBlock*, llvm::DenseMap<llvm::Instruction*, llvm::Value*, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::Value*> >*) total: 107 0.0011 */ | |
/* HandleInlinedLandingPad(llvm::InvokeInst*, llvm::BasicBlock*, llvm::ClonedCodeInfo&) [clone .isra.700] total: 60 6.3e-04 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.4/src/reactor/poll_evented.rs" | |
* | |
* 5576 0.0585 | |
*/ | |
://! Readiness tracking streams, backing I/O objects. | |
://! | |
://! This module contains the core type which is used to back all I/O on object | |
://! in `tokio-core`. The `PollEvented` type is the implementation detail of | |
://! all I/O. Each `PollEvented` manages registration with a reactor, | |
://! acquisition of a token, and tracking of the readiness state on the | |
://! underlying I/O primitive. | |
: | |
:use std::io::{self, Read, Write}; | |
:use std::sync::atomic::{AtomicUsize, Ordering}; | |
: | |
:use futures::Async; | |
:use mio; | |
: | |
:use io::Io; | |
:use reactor::{Handle, Remote}; | |
:use reactor::io_token::IoToken; | |
: | |
:/// A concrete implementation of a stream of readiness notifications for I/O | |
:/// objects that originates from an event loop. | |
:/// | |
:/// Created by the `PollEvented::new` method, each `PollEvented` is | |
:/// associated with a specific event loop and source of events that will be | |
:/// registered with an event loop. | |
:/// | |
:/// Each readiness stream has a number of methods to test whether the underlying | |
:/// object is readable or writable. Once the methods return that an object is | |
:/// readable/writable, then it will continue to do so until the `need_read` or | |
:/// `need_write` methods are called. | |
:/// | |
:/// That is, this object is typically wrapped in another form of I/O object. | |
:/// It's the responsibility of the wrapper to inform the readiness stream when a | |
:/// "would block" I/O event is seen. The readiness stream will then take care of | |
:/// any scheduling necessary to get notified when the event is ready again. | |
:/// | |
:/// You can find more information about creating a custom I/O object [online]. | |
:/// | |
:/// [online]: https://tokio.rs/docs/going-deeper/core-low-level/#custom-io | |
:pub struct PollEvented<E> { | |
: token: IoToken, | |
: handle: Remote, | |
: readiness: AtomicUsize, | |
: io: E, | |
:} | |
: | |
:impl<E: mio::Evented> PollEvented<E> { | |
: /// Creates a new readiness stream associated with the provided | |
: /// `loop_handle` and for the given `source`. | |
: /// | |
: /// This method returns a future which will resolve to the readiness stream | |
: /// when it's ready. | |
: pub fn new(io: E, handle: &Handle) -> io::Result<PollEvented<E>> { | |
: Ok(PollEvented { | |
: token: try!(IoToken::new(&io, handle)), | |
: handle: handle.remote().clone(), | |
: readiness: AtomicUsize::new(0), | |
: io: io, | |
: }) | |
: } | |
: | |
: /// Deregisters this source of events from the reactor core specified. | |
: /// | |
: /// This method can optionally be called to unregister the underlying I/O | |
: /// object with the event loop that the `handle` provided points to. | |
: /// Typically this method is not required as this automatically happens when | |
: /// `E` is dropped, but for some use cases the `E` object doesn't represent | |
: /// an owned reference, so dropping it won't automatically unreigster with | |
: /// the event loop. | |
: /// | |
: /// This consumes `self` as it will no longer provide events after the | |
: /// method is called, and will likely return an error if this `PollEvented` | |
: /// was created on a separate event loop from the `handle` specified. | |
: pub fn deregister(self, handle: &Handle) -> io::Result<()> { | |
: let inner = match handle.inner.upgrade() { | |
: Some(inner) => inner, | |
: None => return Ok(()), | |
: }; | |
: let ret = inner.borrow_mut().deregister_source(&self.io); | |
: return ret | |
: } | |
:} | |
: | |
:impl<E> PollEvented<E> { | |
: /// Tests to see if this source is ready to be read from or not. | |
: /// | |
: /// If this stream is not ready for a read then `NotReady` will be returned | |
: /// and the current task will be scheduled to receive a notification when | |
: /// the stream is readable again. In other words, this method is only safe | |
: /// to call from within the context of a future's task, typically done in a | |
: /// `Future::poll` method. | |
: pub fn poll_read(&self) -> Async<()> { | |
2617 0.0275 : if self.readiness.load(Ordering::SeqCst) & 1 != 0 { | |
: return Async::Ready(()) | |
: } | |
2 2.1e-05 : self.readiness.fetch_or(self.token.take_readiness(), Ordering::SeqCst); | |
6 6.3e-05 : if self.readiness.load(Ordering::SeqCst) & 1 != 0 { | |
: Async::Ready(()) | |
: } else { | |
2 2.1e-05 : self.token.schedule_read(&self.handle); | |
: Async::NotReady | |
: } | |
: } | |
: | |
: /// Tests to see if this source is ready to be written to or not. | |
: /// | |
: /// If this stream is not ready for a write then `NotReady` will be returned | |
: /// and the current task will be scheduled to receive a notification when | |
: /// the stream is writable again. In other words, this method is only safe | |
: /// to call from within the context of a future's task, typically done in a | |
: /// `Future::poll` method. | |
: pub fn poll_write(&self) -> Async<()> { | |
3 3.1e-05 : if self.readiness.load(Ordering::SeqCst) & 2 != 0 { | |
: return Async::Ready(()) | |
: } | |
: self.readiness.fetch_or(self.token.take_readiness(), Ordering::SeqCst); | |
: if self.readiness.load(Ordering::SeqCst) & 2 != 0 { | |
: Async::Ready(()) | |
: } else { | |
: self.token.schedule_write(&self.handle); | |
: Async::NotReady | |
: } | |
: } | |
: | |
: /// Indicates to this source of events that the corresponding I/O object is | |
: /// no longer readable, but it needs to be. | |
: /// | |
: /// This function, like `poll_read`, is only safe to call from the context | |
: /// of a future's task (typically in a `Future::poll` implementation). It | |
: /// informs this readiness stream that the underlying object is no longer | |
: /// readable, typically because a "would block" error was seen. | |
: /// | |
: /// The flag indicating that this stream is readable is unset and the | |
: /// current task is scheduled to receive a notification when the stream is | |
: /// then again readable. | |
: /// | |
: /// Note that it is also only valid to call this method if `poll_read` | |
: /// previously indicated that the object is readable. That is, this function | |
: /// must always be paired with calls to `poll_read` previously. | |
: pub fn need_read(&self) { | |
: self.readiness.fetch_and(!1, Ordering::SeqCst); | |
: self.token.schedule_read(&self.handle) | |
: } | |
: | |
: /// Indicates to this source of events that the corresponding I/O object is | |
: /// no longer writable, but it needs to be. | |
: /// | |
: /// This function, like `poll_write`, is only safe to call from the context | |
: /// of a future's task (typically in a `Future::poll` implementation). It | |
: /// informs this readiness stream that the underlying object is no longer | |
: /// writable, typically because a "would block" error was seen. | |
: /// | |
: /// The flag indicating that this stream is writable is unset and the | |
: /// current task is scheduled to receive a notification when the stream is | |
: /// then again writable. | |
: /// | |
: /// Note that it is also only valid to call this method if `poll_write` | |
: /// previously indicated that the object is writeable. That is, this function | |
: /// must always be paired with calls to `poll_write` previously. | |
: pub fn need_write(&self) { | |
: self.readiness.fetch_and(!2, Ordering::SeqCst); | |
: self.token.schedule_write(&self.handle) | |
: } | |
: | |
: /// Returns a reference to the event loop handle that this readiness stream | |
: /// is associated with. | |
: pub fn remote(&self) -> &Remote { | |
: &self.handle | |
: } | |
: | |
: /// Returns a shared reference to the underlying I/O object this readiness | |
: /// stream is wrapping. | |
: pub fn get_ref(&self) -> &E { | |
: &self.io | |
: } | |
: | |
: /// Returns a mutable reference to the underlying I/O object this readiness | |
: /// stream is wrapping. | |
: pub fn get_mut(&mut self) -> &mut E { | |
374 0.0039 : &mut self.io | |
: } | |
:} | |
: | |
:impl<E: Read> Read for PollEvented<E> { | |
: fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { | |
: if let Async::NotReady = self.poll_read() { | |
: return Err(mio::would_block()) | |
: } | |
63 6.6e-04 : let r = self.get_mut().read(buf); | |
: if is_wouldblock(&r) { | |
: self.need_read(); | |
: } | |
1457 0.0153 : return r | |
: } | |
:} | |
: | |
:impl<E: Write> Write for PollEvented<E> { | |
: fn write(&mut self, buf: &[u8]) -> io::Result<usize> { | |
: if let Async::NotReady = self.poll_write() { | |
: return Err(mio::would_block()) | |
: } | |
: let r = self.get_mut().write(buf); | |
: if is_wouldblock(&r) { | |
: self.need_write(); | |
: } | |
1 1.0e-05 : return r | |
: } | |
: | |
: fn flush(&mut self) -> io::Result<()> { | |
: if let Async::NotReady = self.poll_write() { | |
: return Err(mio::would_block()) | |
: } | |
: let r = self.get_mut().flush(); | |
: if is_wouldblock(&r) { | |
: self.need_write(); | |
: } | |
: return r | |
: } | |
:} | |
: | |
:impl<E: Read + Write> Io for PollEvented<E> { | |
: fn poll_read(&mut self) -> Async<()> { | |
: <PollEvented<E>>::poll_read(self) | |
: } | |
: | |
: fn poll_write(&mut self) -> Async<()> { | |
: <PollEvented<E>>::poll_write(self) | |
: } | |
:} | |
: | |
:impl<'a, E> Read for &'a PollEvented<E> | |
: where &'a E: Read, | |
:{ | |
: fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { | |
: if let Async::NotReady = self.poll_read() { | |
: return Err(mio::would_block()) | |
: } | |
: let r = self.get_ref().read(buf); | |
: if is_wouldblock(&r) { | |
: self.need_read(); | |
: } | |
: return r | |
: } | |
:} | |
: | |
:impl<'a, E> Write for &'a PollEvented<E> | |
: where &'a E: Write, | |
:{ | |
: fn write(&mut self, buf: &[u8]) -> io::Result<usize> { | |
: if let Async::NotReady = self.poll_write() { | |
: return Err(mio::would_block()) | |
: } | |
: let r = self.get_ref().write(buf); | |
: if is_wouldblock(&r) { | |
: self.need_write(); | |
: } | |
: return r | |
: } | |
: | |
: fn flush(&mut self) -> io::Result<()> { | |
: if let Async::NotReady = self.poll_write() { | |
: return Err(mio::would_block()) | |
: } | |
: let r = self.get_ref().flush(); | |
: if is_wouldblock(&r) { | |
: self.need_write(); | |
: } | |
: return r | |
: } | |
:} | |
: | |
:impl<'a, E> Io for &'a PollEvented<E> | |
: where &'a E: Read + Write, | |
:{ | |
: fn poll_read(&mut self) -> Async<()> { | |
: <PollEvented<E>>::poll_read(self) | |
: } | |
: | |
: fn poll_write(&mut self) -> Async<()> { | |
: <PollEvented<E>>::poll_write(self) | |
: } | |
:} | |
: | |
:fn is_wouldblock<T>(r: &io::Result<T>) -> bool { | |
: match *r { | |
1050 0.0110 : Ok(_) => false, | |
1 1.0e-05 : Err(ref e) => e.kind() == io::ErrorKind::WouldBlock, | |
: } | |
:} | |
: | |
:impl<E> Drop for PollEvented<E> { | |
: fn drop(&mut self) { | |
: self.token.drop_source(&self.handle); | |
: } | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/git/checkouts/hyper-817b53a166fc1c58/499c0d1/src/http/body.rs" | |
* | |
* 5465 0.0574 | |
*/ | |
:use std::convert::From; | |
:use std::sync::Arc; | |
: | |
:use tokio_proto; | |
:use http::Chunk; | |
:use futures::{Poll, Stream}; | |
:use futures::sync::mpsc; | |
: | |
:pub type TokioBody = tokio_proto::streaming::Body<Chunk, ::Error>; | |
: | |
:/// A `Stream` for `Chunk`s used in requests and responses. | |
:#[derive(Debug)] | |
:pub struct Body(TokioBody); | |
: | |
:impl Body { | |
: /// Return an empty body stream | |
: pub fn empty() -> Body { | |
: Body(TokioBody::empty()) | |
: } | |
: | |
: /// Return a body stream with an associated sender half | |
: pub fn pair() -> (mpsc::Sender<Result<Chunk, ::Error>>, Body) { | |
: let (tx, rx) = TokioBody::pair(); | |
: let rx = Body(rx); | |
: (tx, rx) | |
: } | |
:} | |
: | |
:impl Stream for Body { | |
: type Item = Chunk; | |
: type Error = ::Error; | |
: | |
4351 0.0457 : fn poll(&mut self) -> Poll<Option<Chunk>, ::Error> { /* _$LT$hyper..http..body..Body$u20$as$u20$futures..stream..Stream$GT$::poll::hf5c2c0cbfb51183f total: 33479 0.3515 */ | |
: self.0.poll() | |
1109 0.0116 : } | |
:} | |
: | |
:impl From<Body> for tokio_proto::streaming::Body<Chunk, ::Error> { | |
: fn from(b: Body) -> tokio_proto::streaming::Body<Chunk, ::Error> { | |
: b.0 | |
: } | |
:} | |
: | |
:impl From<tokio_proto::streaming::Body<Chunk, ::Error>> for Body { | |
1 1.0e-05 : fn from(tokio_body: tokio_proto::streaming::Body<Chunk, ::Error>) -> Body { /* _$LT$hyper..http..body..Body$u20$as$u20$core..convert..From$LT$tokio_proto..streaming..body..Body$LT$hyper..http..chunk..Chunk$C$$u20$hyper..error..Error$GT$$GT$$GT$::from::h0772d9e7bb2daa60 total: 5 5.2e-05 */ | |
4 4.2e-05 : Body(tokio_body) | |
: } | |
:} | |
: | |
:impl From<mpsc::Receiver<Result<Chunk, ::Error>>> for Body { | |
: fn from(src: mpsc::Receiver<Result<Chunk, ::Error>>) -> Body { | |
: Body(src.into()) | |
: } | |
:} | |
: | |
:impl From<Chunk> for Body { | |
: fn from (chunk: Chunk) -> Body { | |
: Body(TokioBody::from(chunk)) | |
: } | |
:} | |
: | |
:impl From<Vec<u8>> for Body { | |
: fn from (vec: Vec<u8>) -> Body { | |
: Body(TokioBody::from(Chunk::from(vec))) | |
: } | |
:} | |
: | |
:impl From<Arc<Vec<u8>>> for Body { | |
: fn from (vec: Arc<Vec<u8>>) -> Body { | |
: Body(TokioBody::from(Chunk::from(vec))) | |
: } | |
:} | |
: | |
:impl From<&'static [u8]> for Body { | |
: fn from (slice: &'static [u8]) -> Body { | |
: Body(TokioBody::from(Chunk::from(slice))) | |
: } | |
:} | |
: | |
:impl From<String> for Body { | |
: fn from (s: String) -> Body { | |
: Body(TokioBody::from(Chunk::from(s.into_bytes()))) | |
: } | |
:} | |
: | |
:impl From<&'static str> for Body { | |
: fn from (slice: &'static str) -> Body { | |
: Body(TokioBody::from(Chunk::from(slice.as_bytes()))) | |
: } | |
:} | |
: | |
:fn _assert_send() { | |
: fn _assert<T: Send>() {} | |
: | |
: _assert::<Body>(); | |
: _assert::<Chunk>(); | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-proto-0.1.0/src/streaming/body.rs" | |
* | |
* 5423 0.0569 | |
*/ | |
:use std::fmt; | |
: | |
:use futures::{Async, Poll, Stream}; | |
:use futures::sync::mpsc; | |
: | |
:/// Body stream | |
:pub struct Body<T, E> { | |
: inner: Inner<T, E>, | |
:} | |
: | |
:enum Inner<T, E> { | |
: Once(Option<T>), | |
: Stream(mpsc::Receiver<Result<T, E>>), | |
: Empty, | |
:} | |
: | |
:impl<T, E> Body<T, E> { | |
: /// Return an empty body stream | |
: pub fn empty() -> Body<T, E> { | |
: Body { inner: Inner::Empty } | |
: } | |
: | |
: /// Return a body stream with an associated sender half | |
: pub fn pair() -> (mpsc::Sender<Result<T, E>>, Body<T, E>) { | |
: let (tx, rx) = mpsc::channel(0); | |
: let rx = Body { inner: Inner::Stream(rx) }; | |
: (tx, rx) | |
: } | |
:} | |
: | |
:impl<T, E> Stream for Body<T, E> { | |
: type Item = T; | |
: type Error = E; | |
: | |
: fn poll(&mut self) -> Poll<Option<T>, E> { | |
: match self.inner { | |
1253 0.0132 : Inner::Once(ref mut val) => Ok(Async::Ready(val.take())), | |
160 0.0017 : Inner::Stream(ref mut s) => { | |
: match s.poll().unwrap() { | |
368 0.0039 : Async::Ready(None) => Ok(Async::Ready(None)), | |
3324 0.0349 : Async::Ready(Some(Ok(e))) => Ok(Async::Ready(Some(e))), | |
: Async::Ready(Some(Err(e))) => Err(e), | |
176 0.0018 : Async::NotReady => Ok(Async::NotReady), | |
: } | |
142 0.0015 : } | |
: Inner::Empty => Ok(Async::Ready(None)), | |
: } | |
: } | |
:} | |
: | |
:impl<T, E> From<mpsc::Receiver<Result<T, E>>> for Body<T, E> { | |
: fn from(src: mpsc::Receiver<Result<T, E>>) -> Body<T, E> { | |
: Body { inner: Inner::Stream(src) } | |
: } | |
:} | |
: | |
:impl<T, E> From<T> for Body<T, E> { | |
: fn from(val: T) -> Body<T, E> { | |
: Body { inner: Inner::Once(Some(val)) } | |
: } | |
:} | |
: | |
:impl<T, E> fmt::Debug for Body<T, E> { | |
: fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
: write!(fmt, "Body {{ [stream of values] }}") | |
: } | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/future/mod.rs" | |
* | |
* 5256 0.0552 | |
*/ | |
://! Futures | |
://! | |
://! This module contains the `Future` trait and a number of adaptors for this | |
://! trait. See the crate docs, and the docs for `Future`, for full detail. | |
: | |
:use core::result; | |
: | |
:// Primitive futures | |
:mod empty; | |
:mod lazy; | |
:mod poll_fn; | |
:#[path = "result.rs"] | |
:mod result_; | |
:mod loop_fn; | |
:mod option; | |
:pub use self::empty::{empty, Empty}; | |
:pub use self::lazy::{lazy, Lazy}; | |
:pub use self::poll_fn::{poll_fn, PollFn}; | |
:pub use self::result_::{result, ok, err, FutureResult}; | |
:pub use self::loop_fn::{loop_fn, Loop, LoopFn}; | |
: | |
:#[doc(hidden)] | |
:#[deprecated(since = "0.1.4", note = "use `ok` instead")] | |
:#[cfg(feature = "with-deprecated")] | |
:pub use self::{ok as finished, Ok as Finished}; | |
:#[doc(hidden)] | |
:#[deprecated(since = "0.1.4", note = "use `err` instead")] | |
:#[cfg(feature = "with-deprecated")] | |
:pub use self::{err as failed, Err as Failed}; | |
:#[doc(hidden)] | |
:#[deprecated(since = "0.1.4", note = "use `result` instead")] | |
:#[cfg(feature = "with-deprecated")] | |
:pub use self::{result as done, FutureResult as Done}; | |
:#[doc(hidden)] | |
:#[deprecated(since = "0.1.7", note = "use `FutureResult` instead")] | |
:#[cfg(feature = "with-deprecated")] | |
:pub use self::{FutureResult as Ok}; | |
:#[doc(hidden)] | |
:#[deprecated(since = "0.1.7", note = "use `FutureResult` instead")] | |
:#[cfg(feature = "with-deprecated")] | |
:pub use self::{FutureResult as Err}; | |
: | |
:// combinators | |
:mod and_then; | |
:mod flatten; | |
:mod flatten_stream; | |
:mod fuse; | |
:mod into_stream; | |
:mod join; | |
:mod map; | |
:mod map_err; | |
:mod from_err; | |
:mod or_else; | |
:mod select; | |
:mod then; | |
:mod either; | |
: | |
:// impl details | |
:mod chain; | |
: | |
:pub use self::and_then::AndThen; | |
:pub use self::flatten::Flatten; | |
:pub use self::flatten_stream::FlattenStream; | |
:pub use self::fuse::Fuse; | |
:pub use self::into_stream::IntoStream; | |
:pub use self::join::{Join, Join3, Join4, Join5}; | |
:pub use self::map::Map; | |
:pub use self::map_err::MapErr; | |
:pub use self::from_err::FromErr; | |
:pub use self::or_else::OrElse; | |
:pub use self::select::{Select, SelectNext}; | |
:pub use self::then::Then; | |
:pub use self::either::Either; | |
: | |
:if_std! { | |
: mod catch_unwind; | |
: mod join_all; | |
: mod select_all; | |
: mod select_ok; | |
: mod shared; | |
: pub use self::catch_unwind::CatchUnwind; | |
: pub use self::join_all::{join_all, JoinAll}; | |
: pub use self::select_all::{SelectAll, SelectAllNext, select_all}; | |
: pub use self::select_ok::{SelectOk, select_ok}; | |
: pub use self::shared::{Shared, SharedItem, SharedError}; | |
: | |
: #[doc(hidden)] | |
: #[deprecated(since = "0.1.4", note = "use join_all instead")] | |
: #[cfg(feature = "with-deprecated")] | |
: pub use self::join_all::join_all as collect; | |
: #[doc(hidden)] | |
: #[deprecated(since = "0.1.4", note = "use JoinAll instead")] | |
: #[cfg(feature = "with-deprecated")] | |
: pub use self::join_all::JoinAll as Collect; | |
: | |
: /// A type alias for `Box<Future + Send>` | |
: pub type BoxFuture<T, E> = ::std::boxed::Box<Future<Item = T, Error = E> + Send>; | |
: | |
: impl<F: ?Sized + Future> Future for ::std::boxed::Box<F> { | |
: type Item = F::Item; | |
: type Error = F::Error; | |
: | |
: fn poll(&mut self) -> Poll<Self::Item, Self::Error> { | |
5256 0.0552 : (**self).poll() | |
: } | |
: } | |
:} | |
: | |
:use {Poll, stream}; | |
: | |
:/// Trait for types which are a placeholder of a value that will become | |
:/// available at possible some later point in time. | |
:/// | |
:/// In addition to the documentation here you can also find more information | |
:/// about futures [online] at [https://tokio.rs](https://tokio.rs) | |
:/// | |
:/// [online]: https://tokio.rs/docs/getting-started/futures/ | |
:/// | |
:/// Futures are used to provide a sentinel through which a value can be | |
:/// referenced. They crucially allow chaining and composing operations through | |
:/// consumption which allows expressing entire trees of computation as one | |
:/// sentinel value. | |
:/// | |
:/// The ergonomics and implementation of the `Future` trait are very similar to | |
:/// the `Iterator` trait in Rust which is where there is a small handful of | |
:/// methods to implement and a load of default methods that consume a `Future`, | |
:/// producing a new value. | |
:/// | |
:/// # The `poll` method | |
:/// | |
:/// The core method of future, `poll`, is used to attempt to generate the value | |
:/// of a `Future`. This method *does not block* but is allowed to inform the | |
:/// caller that the value is not ready yet. Implementations of `poll` may | |
:/// themselves do work to generate the value, but it's guaranteed that this will | |
:/// never block the calling thread. | |
:/// | |
:/// A key aspect of this method is that if the value is not yet available the | |
:/// current task is scheduled to receive a notification when it's later ready to | |
:/// be made available. This follows what's typically known as a "readiness" or | |
:/// "pull" model where values are pulled out of futures on demand, and | |
:/// otherwise a task is notified when a value might be ready to get pulled out. | |
:/// | |
:/// The `poll` method is not intended to be called in general, but rather is | |
:/// typically called in the context of a "task" which drives a future to | |
:/// completion. For more information on this see the `task` module. | |
:/// | |
:/// More information about the details of `poll` and the nitty-gritty of tasks | |
:/// can be [found online at tokio.rs][poll-dox]. | |
:/// | |
:/// [poll-dox]: https://tokio.rs/docs/going-deeper/futures-model/ | |
:/// | |
:/// # Combinators | |
:/// | |
:/// Like iterators, futures provide a large number of combinators to work with | |
:/// futures to express computations in a much more natural method than | |
:/// scheduling a number of callbacks. For example the `map` method can change | |
:/// a `Future<Item=T>` to a `Future<Item=U>` or an `and_then` combinator could | |
:/// create a future after the first one is done and only be resolved when the | |
:/// second is done. | |
:/// | |
:/// Combinators act very similarly to the methods on the `Iterator` trait itself | |
:/// or those on `Option` and `Result`. Like with iterators, the combinators are | |
:/// zero-cost and don't impose any extra layers of indirection you wouldn't | |
:/// otherwise have to write down. | |
:/// | |
:/// More information about combinators can be found [on tokio.rs]. | |
:/// | |
:/// [on tokio.rs]: https://tokio.rs/docs/going-deeper/futures-mechanics/ | |
:pub trait Future { | |
: /// The type of value that this future will resolved with if it is | |
: /// successful. | |
: type Item; | |
: | |
: /// The type of error that this future will resolve with if it fails in a | |
: /// normal fashion. | |
: type Error; | |
: | |
: /// Query this future to see if its value has become available, registering | |
: /// interest if it is not. | |
: /// | |
: /// This function will check the internal state of the future and assess | |
: /// whether the value is ready to be produced. Implementors of this function | |
: /// should ensure that a call to this **never blocks** as event loops may | |
: /// not work properly otherwise. | |
: /// | |
: /// When a future is not ready yet, the `Async::NotReady` value will be | |
: /// returned. In this situation the future will *also* register interest of | |
: /// the current task in the value being produced. This is done by calling | |
: /// `task::park` to retreive a handle to the current `Task`. When the future | |
: /// is then ready to make progress (e.g. it should be poll'd again) then the | |
: /// `unpark` method is called on the `Task`. | |
: /// | |
: /// More information about the details of `poll` and the nitty-gritty of | |
: /// tasks can be [found online at tokio.rs][poll-dox]. | |
: /// | |
: /// [poll-dox]: https://tokio.rs/docs/going-deeper/futures-model/ | |
: /// | |
: /// # Runtime characteristics | |
: /// | |
: /// This function, `poll`, is the primary method for 'making progress' | |
: /// within a tree of futures. For example this method will be called | |
: /// repeatedly as the internal state machine makes its various transitions. | |
: /// Executors are responsible for ensuring that this function is called in | |
: /// the right location (e.g. always on an I/O thread or not). Unless it is | |
: /// otherwise arranged to be so, it should be ensured that **implementations | |
: /// of this function finish very quickly**. | |
: /// | |
: /// Returning quickly prevents unnecessarily clogging up threads and/or | |
: /// event loops while a `poll` function call, for example, takes up compute | |
: /// resources to perform some expensive computation. If it is known ahead | |
: /// of time that a call to `poll` may end up taking awhile, the work should | |
: /// be offloaded to a thread pool (or something similar) to ensure that | |
: /// `poll` can return quickly. | |
: /// | |
: /// # Return value | |
: /// | |
: /// This function returns `Async::NotReady` if the future is not ready yet, | |
: /// `Err` if the future is finished but resolved to an error, or | |
: /// `Async::Ready` with the result of this future if it's finished | |
: /// successfully. Once a future has finished it is considered a contract | |
: /// error to continue polling the future. | |
: /// | |
: /// If `NotReady` is returned, then the future will internally register | |
: /// interest in the value being produced for the current task (through | |
: /// `task::park`). In other words, the current task will receive a | |
: /// notification (through the `unpark` method) once the value is ready to be | |
: /// produced or the future can make progress. | |
: /// | |
: /// # Panics | |
: /// | |
: /// Once a future has completed (returned `Ready` or `Err` from `poll`), | |
: /// then any future calls to `poll` may panic, block forever, or otherwise | |
: /// cause wrong behavior. The `Future` trait itself provides no guarantees | |
: /// about the behavior of `poll` after a future has completed. | |
: /// | |
: /// Callers who may call `poll` too many times may want to consider using | |
: /// the `fuse` adaptor which defines the behavior of `poll`, but comes with | |
: /// a little bit of extra cost. | |
: /// | |
: /// Additionally, calls to `poll` must always be made from within the | |
: /// context of a task. If a current task is not set then this method will | |
: /// likely panic. | |
: /// | |
: /// # Errors | |
: /// | |
: /// This future may have failed to finish the computation, in which case | |
: /// the `Err` variant will be returned with an appropriate payload of an | |
: /// error. | |
: fn poll(&mut self) -> Poll<Self::Item, Self::Error>; | |
: | |
: /// Block the current thread until this future is resolved. | |
: /// | |
: /// This method will consume ownership of this future, driving it to | |
: /// completion via `poll` and blocking the current thread while it's waiting | |
: /// for the value to become available. Once the future is resolved the | |
: /// result of this future is returned. | |
: /// | |
: /// > **Note:** This method is not appropriate to call on event loops or | |
: /// > similar I/O situations because it will prevent the event | |
: /// > loop from making progress (this blocks the thread). This | |
: /// > method should only be called when it's guaranteed that the | |
: /// > blocking work associated with this future will be completed | |
: /// > by another thread. | |
: /// | |
: /// This method is only available when the `use_std` feature of this | |
: /// library is activated, and it is activated by default. | |
: /// | |
: /// # Panics | |
: /// | |
: /// This function does not attempt to catch panics. If the `poll` function | |
: /// of this future panics, panics will be propagated to the caller. | |
: #[cfg(feature = "use_std")] | |
: fn wait(self) -> result::Result<Self::Item, Self::Error> | |
: where Self: Sized | |
: { | |
: ::executor::spawn(self).wait_future() | |
: } | |
: | |
: /// Convenience function for turning this future into a trait object which | |
: /// is also `Send`. | |
: /// | |
: /// This simply avoids the need to write `Box::new` and can often help with | |
: /// type inference as well by always returning a trait object. Note that | |
: /// this method requires the `Send` bound and returns a `BoxFuture`, which | |
: /// also encodes this. If you'd like to create a `Box<Future>` without the | |
: /// `Send` bound, then the `Box::new` function can be used instead. | |
: /// | |
: /// This method is only available when the `use_std` feature of this | |
: /// library is activated, and it is activated by default. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let a: BoxFuture<i32, i32> = result(Ok(1)).boxed(); | |
: /// ``` | |
: #[cfg(feature = "use_std")] | |
: fn boxed(self) -> BoxFuture<Self::Item, Self::Error> | |
: where Self: Sized + Send + 'static | |
: { | |
: ::std::boxed::Box::new(self) | |
: } | |
: | |
: /// Map this future's result to a different type, returning a new future of | |
: /// the resulting type. | |
: /// | |
: /// This function is similar to the `Option::map` or `Iterator::map` where | |
: /// it will change the type of the underlying future. This is useful to | |
: /// chain along a computation once a future has been resolved. | |
: /// | |
: /// The closure provided will only be called if this future is resolved | |
: /// successfully. If this future returns an error, panics, or is dropped, | |
: /// then the closure provided will never be invoked. | |
: /// | |
: /// Note that this function consumes the receiving future and returns a | |
: /// wrapped version of it, similar to the existing `map` methods in the | |
: /// standard library. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let future_of_1 = ok::<u32, u32>(1); | |
: /// let future_of_4 = future_of_1.map(|x| x + 3); | |
: /// ``` | |
: fn map<F, U>(self, f: F) -> Map<Self, F> | |
: where F: FnOnce(Self::Item) -> U, | |
: Self: Sized, | |
: { | |
: assert_future::<U, Self::Error, _>(map::new(self, f)) | |
: } | |
: | |
: /// Map this future's error to a different error, returning a new future. | |
: /// | |
: /// This function is similar to the `Result::map_err` where it will change | |
: /// the error type of the underlying future. This is useful for example to | |
: /// ensure that futures have the same error type when used with combinators | |
: /// like `select` and `join`. | |
: /// | |
: /// The closure provided will only be called if this future is resolved | |
: /// with an error. If this future returns a success, panics, or is | |
: /// dropped, then the closure provided will never be invoked. | |
: /// | |
: /// Note that this function consumes the receiving future and returns a | |
: /// wrapped version of it. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let future_of_err_1 = err::<u32, u32>(1); | |
: /// let future_of_err_4 = future_of_err_1.map_err(|x| x + 3); | |
: /// ``` | |
: fn map_err<F, E>(self, f: F) -> MapErr<Self, F> | |
: where F: FnOnce(Self::Error) -> E, | |
: Self: Sized, | |
: { | |
: assert_future::<Self::Item, E, _>(map_err::new(self, f)) | |
: } | |
: | |
: | |
: | |
: /// Map this future's error to any error implementing `From` for | |
: /// this future's `Error`, returning a new future. | |
: /// | |
: /// This function does for futures what `try!` does for `Result`, | |
: /// by letting the compiler infer the type of the resulting error. | |
: /// Just as `map_err` above, this is useful for example to ensure | |
: /// that futures have the same error type when used with | |
: /// combinators like `select` and `join`. | |
: /// | |
: /// Note that this function consumes the receiving future and returns a | |
: /// wrapped version of it. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let future_of_err_1 = err::<u32, u32>(1); | |
: /// let future_of_err_4 = future_of_err_1.from_err::<u32>(); | |
: /// ``` | |
: fn from_err<E:From<Self::Error>>(self) -> FromErr<Self, E> | |
: where Self: Sized, | |
: { | |
: assert_future::<Self::Item, E, _>(from_err::new(self)) | |
: } | |
: | |
: /// Chain on a computation for when a future finished, passing the result of | |
: /// the future to the provided closure `f`. | |
: /// | |
: /// This function can be used to ensure a computation runs regardless of | |
: /// the conclusion of the future. The closure provided will be yielded a | |
: /// `Result` once the future is complete. | |
: /// | |
: /// The returned value of the closure must implement the `IntoFuture` trait | |
: /// and can represent some more work to be done before the composed future | |
: /// is finished. Note that the `Result` type implements the `IntoFuture` | |
: /// trait so it is possible to simply alter the `Result` yielded to the | |
: /// closure and return it. | |
: /// | |
: /// If this future is dropped or panics then the closure `f` will not be | |
: /// run. | |
: /// | |
: /// Note that this function consumes the receiving future and returns a | |
: /// wrapped version of it. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let future_of_1 = ok::<u32, u32>(1); | |
: /// let future_of_4 = future_of_1.then(|x| { | |
: /// x.map(|y| y + 3) | |
: /// }); | |
: /// | |
: /// let future_of_err_1 = err::<u32, u32>(1); | |
: /// let future_of_4 = future_of_err_1.then(|x| { | |
: /// match x { | |
: /// Ok(_) => panic!("expected an error"), | |
: /// Err(y) => ok::<u32, u32>(y + 3), | |
: /// } | |
: /// }); | |
: /// ``` | |
: fn then<F, B>(self, f: F) -> Then<Self, B, F> | |
: where F: FnOnce(result::Result<Self::Item, Self::Error>) -> B, | |
: B: IntoFuture, | |
: Self: Sized, | |
: { | |
: assert_future::<B::Item, B::Error, _>(then::new(self, f)) | |
: } | |
: | |
: /// Execute another future after this one has resolved successfully. | |
: /// | |
: /// This function can be used to chain two futures together and ensure that | |
: /// the final future isn't resolved until both have finished. The closure | |
: /// provided is yielded the successful result of this future and returns | |
: /// another value which can be converted into a future. | |
: /// | |
: /// Note that because `Result` implements the `IntoFuture` trait this method | |
: /// can also be useful for chaining fallible and serial computations onto | |
: /// the end of one future. | |
: /// | |
: /// If this future is dropped, panics, or completes with an error then the | |
: /// provided closure `f` is never called. | |
: /// | |
: /// Note that this function consumes the receiving future and returns a | |
: /// wrapped version of it. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let future_of_1 = ok::<u32, u32>(1); | |
: /// let future_of_4 = future_of_1.and_then(|x| { | |
: /// Ok(x + 3) | |
: /// }); | |
: /// | |
: /// let future_of_err_1 = err::<u32, u32>(1); | |
: /// future_of_err_1.and_then(|_| -> FutureResult<u32, u32> { | |
: /// panic!("should not be called in case of an error"); | |
: /// }); | |
: /// ``` | |
: fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> | |
: where F: FnOnce(Self::Item) -> B, | |
: B: IntoFuture<Error = Self::Error>, | |
: Self: Sized, | |
: { | |
: assert_future::<B::Item, Self::Error, _>(and_then::new(self, f)) | |
: } | |
: | |
: /// Execute another future if this one resolves with an error. | |
: /// | |
: /// Return a future that passes along this future's value if it succeeds, | |
: /// and otherwise passes the error to the closure `f` and waits for the | |
: /// future it returns. The closure may also simply return a value that can | |
: /// be converted into a future. | |
: /// | |
: /// Note that because `Result` implements the `IntoFuture` trait this method | |
: /// can also be useful for chaining together fallback computations, where | |
: /// when one fails, the next is attempted. | |
: /// | |
: /// If this future is dropped, panics, or completes successfully then the | |
: /// provided closure `f` is never called. | |
: /// | |
: /// Note that this function consumes the receiving future and returns a | |
: /// wrapped version of it. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let future_of_err_1 = err::<u32, u32>(1); | |
: /// let future_of_4 = future_of_err_1.or_else(|x| -> Result<u32, u32> { | |
: /// Ok(x + 3) | |
: /// }); | |
: /// | |
: /// let future_of_1 = ok::<u32, u32>(1); | |
: /// future_of_1.or_else(|_| -> FutureResult<u32, u32> { | |
: /// panic!("should not be called in case of success"); | |
: /// }); | |
: /// ``` | |
: fn or_else<F, B>(self, f: F) -> OrElse<Self, B, F> | |
: where F: FnOnce(Self::Error) -> B, | |
: B: IntoFuture<Item = Self::Item>, | |
: Self: Sized, | |
: { | |
: assert_future::<Self::Item, B::Error, _>(or_else::new(self, f)) | |
: } | |
: | |
: /// Waits for either one of two futures to complete. | |
: /// | |
: /// This function will return a new future which awaits for either this or | |
: /// the `other` future to complete. The returned future will finish with | |
: /// both the value resolved and a future representing the completion of the | |
: /// other work. Both futures must have the same item and error type. | |
: /// | |
: /// Note that this function consumes the receiving futures and returns a | |
: /// wrapped version of them. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// // A poor-man's join implemented on top of select | |
: /// | |
: /// fn join<A>(a: A, b: A) -> BoxFuture<(u32, u32), u32> | |
: /// where A: Future<Item = u32, Error = u32> + Send + 'static, | |
: /// { | |
: /// a.select(b).then(|res| { | |
: /// match res { | |
: /// Ok((a, b)) => b.map(move |b| (a, b)).boxed(), | |
: /// Err((a, _)) => err(a).boxed(), | |
: /// } | |
: /// }).boxed() | |
: /// } | |
: /// ``` | |
: fn select<B>(self, other: B) -> Select<Self, B::Future> | |
: where B: IntoFuture<Item=Self::Item, Error=Self::Error>, | |
: Self: Sized, | |
: { | |
: let f = select::new(self, other.into_future()); | |
: assert_future::<(Self::Item, SelectNext<Self, B::Future>), | |
: (Self::Error, SelectNext<Self, B::Future>), _>(f) | |
: } | |
: | |
: /// Joins the result of two futures, waiting for them both to complete. | |
: /// | |
: /// This function will return a new future which awaits both this and the | |
: /// `other` future to complete. The returned future will finish with a tuple | |
: /// of both results. | |
: /// | |
: /// Both futures must have the same error type, and if either finishes with | |
: /// an error then the other will be dropped and that error will be | |
: /// returned. | |
: /// | |
: /// Note that this function consumes the receiving future and returns a | |
: /// wrapped version of it. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let a = ok::<u32, u32>(1); | |
: /// let b = ok::<u32, u32>(2); | |
: /// let pair = a.join(b); | |
: /// | |
: /// pair.map(|(a, b)| { | |
: /// assert_eq!(a, 1); | |
: /// assert_eq!(b, 2); | |
: /// }); | |
: /// ``` | |
: fn join<B>(self, other: B) -> Join<Self, B::Future> | |
: where B: IntoFuture<Error=Self::Error>, | |
: Self: Sized, | |
: { | |
: let f = join::new(self, other.into_future()); | |
: assert_future::<(Self::Item, B::Item), Self::Error, _>(f) | |
: } | |
: | |
: /// Same as `join`, but with more futures. | |
: fn join3<B, C>(self, b: B, c: C) -> Join3<Self, B::Future, C::Future> | |
: where B: IntoFuture<Error=Self::Error>, | |
: C: IntoFuture<Error=Self::Error>, | |
: Self: Sized, | |
: { | |
: join::new3(self, b.into_future(), c.into_future()) | |
: } | |
: | |
: /// Same as `join`, but with more futures. | |
: fn join4<B, C, D>(self, b: B, c: C, d: D) | |
: -> Join4<Self, B::Future, C::Future, D::Future> | |
: where B: IntoFuture<Error=Self::Error>, | |
: C: IntoFuture<Error=Self::Error>, | |
: D: IntoFuture<Error=Self::Error>, | |
: Self: Sized, | |
: { | |
: join::new4(self, b.into_future(), c.into_future(), d.into_future()) | |
: } | |
: | |
: /// Same as `join`, but with more futures. | |
: fn join5<B, C, D, E>(self, b: B, c: C, d: D, e: E) | |
: -> Join5<Self, B::Future, C::Future, D::Future, E::Future> | |
: where B: IntoFuture<Error=Self::Error>, | |
: C: IntoFuture<Error=Self::Error>, | |
: D: IntoFuture<Error=Self::Error>, | |
: E: IntoFuture<Error=Self::Error>, | |
: Self: Sized, | |
: { | |
: join::new5(self, b.into_future(), c.into_future(), d.into_future(), | |
: e.into_future()) | |
: } | |
: | |
: /// Convert this future into a single element stream. | |
: /// | |
: /// The returned stream contains single success if this future resolves to | |
: /// success or single error if this future resolves into error. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::{Stream, Async}; | |
: /// use futures::future::*; | |
: /// | |
: /// let future = ok::<_, bool>(17); | |
: /// let mut stream = future.into_stream(); | |
: /// assert_eq!(Ok(Async::Ready(Some(17))), stream.poll()); | |
: /// assert_eq!(Ok(Async::Ready(None)), stream.poll()); | |
: /// | |
: /// let future = err::<bool, _>(19); | |
: /// let mut stream = future.into_stream(); | |
: /// assert_eq!(Err(19), stream.poll()); | |
: /// assert_eq!(Ok(Async::Ready(None)), stream.poll()); | |
: /// ``` | |
: fn into_stream(self) -> IntoStream<Self> | |
: where Self: Sized | |
: { | |
: into_stream::new(self) | |
: } | |
: | |
: /// Flatten the execution of this future when the successful result of this | |
: /// future is itself another future. | |
: /// | |
: /// This can be useful when combining futures together to flatten the | |
: /// computation out the the final result. This method can only be called | |
: /// when the successful result of this future itself implements the | |
: /// `IntoFuture` trait and the error can be created from this future's error | |
: /// type. | |
: /// | |
: /// This method is roughly equivalent to `self.and_then(|x| x)`. | |
: /// | |
: /// Note that this function consumes the receiving future and returns a | |
: /// wrapped version of it. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let future_of_a_future = ok::<_, u32>(ok::<u32, u32>(1)); | |
: /// let future_of_1 = future_of_a_future.flatten(); | |
: /// ``` | |
: fn flatten(self) -> Flatten<Self> | |
: where Self::Item: IntoFuture, | |
: <<Self as Future>::Item as IntoFuture>::Error: | |
: From<<Self as Future>::Error>, | |
: Self: Sized | |
: { | |
: let f = flatten::new(self); | |
: assert_future::<<<Self as Future>::Item as IntoFuture>::Item, | |
: <<Self as Future>::Item as IntoFuture>::Error, | |
: _>(f) | |
: } | |
: | |
: /// Flatten the execution of this future when the successful result of this | |
: /// future is a stream. | |
: /// | |
: /// This can be useful when stream initialization is deferred, and it is | |
: /// convenient to work with that stream as if stream was available at the | |
: /// call site. | |
: /// | |
: /// Note that this function consumes this future and returns a wrapped | |
: /// version of it. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::stream::{self, Stream}; | |
: /// use futures::future::*; | |
: /// | |
: /// let stream_items = vec![Ok(17), Err(true), Ok(19)]; | |
: /// let future_of_a_stream = ok::<_, bool>(stream::iter(stream_items)); | |
: /// | |
: /// let stream = future_of_a_stream.flatten_stream(); | |
: /// | |
: /// let mut iter = stream.wait(); | |
: /// assert_eq!(Ok(17), iter.next().unwrap()); | |
: /// assert_eq!(Err(true), iter.next().unwrap()); | |
: /// assert_eq!(Ok(19), iter.next().unwrap()); | |
: /// assert_eq!(None, iter.next()); | |
: /// ``` | |
: fn flatten_stream(self) -> FlattenStream<Self> | |
: where <Self as Future>::Item: stream::Stream<Error=Self::Error>, | |
: Self: Sized | |
: { | |
: flatten_stream::new(self) | |
: } | |
: | |
: /// Fuse a future such that `poll` will never again be called once it has | |
: /// completed. | |
: /// | |
: /// Currently once a future has returned `Ready` or `Err` from | |
: /// `poll` any further calls could exhibit bad behavior such as blocking | |
: /// forever, panicking, never returning, etc. If it is known that `poll` | |
: /// may be called too often then this method can be used to ensure that it | |
: /// has defined semantics. | |
: /// | |
: /// Once a future has been `fuse`d and it returns a completion from `poll`, | |
: /// then it will forever return `NotReady` from `poll` again (never | |
: /// resolve). This, unlike the trait's `poll` method, is guaranteed. | |
: /// | |
: /// This combinator will drop this future as soon as it's been completed to | |
: /// ensure resources are reclaimed as soon as possible. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ```rust | |
: /// use futures::Async; | |
: /// use futures::future::*; | |
: /// | |
: /// let mut future = ok::<i32, u32>(2); | |
: /// assert_eq!(future.poll(), Ok(Async::Ready(2))); | |
: /// | |
: /// // Normally, a call such as this would panic: | |
: /// //future.poll(); | |
: /// | |
: /// // This, however, is guaranteed to not panic | |
: /// let mut future = ok::<i32, u32>(2).fuse(); | |
: /// assert_eq!(future.poll(), Ok(Async::Ready(2))); | |
: /// assert_eq!(future.poll(), Ok(Async::NotReady)); | |
: /// ``` | |
: fn fuse(self) -> Fuse<Self> | |
: where Self: Sized | |
: { | |
: let f = fuse::new(self); | |
: assert_future::<Self::Item, Self::Error, _>(f) | |
: } | |
: | |
: /// Catches unwinding panics while polling the future. | |
: /// | |
: /// In general, panics within a future can propagate all the way out to the | |
: /// task level. This combinator makes it possible to halt unwinding within | |
: /// the future itself. It's most commonly used within task executors. It's | |
: /// not recommended to use this for error handling. | |
: /// | |
: /// Note that this method requires the `UnwindSafe` bound from the standard | |
: /// library. This isn't always applied automatically, and the standard | |
: /// library provides an `AssertUnwindSafe` wrapper type to apply it | |
: /// after-the fact. To assist using this method, the `Future` trait is also | |
: /// implemented for `AssertUnwindSafe<F>` where `F` implements `Future`. | |
: /// | |
: /// This method is only available when the `use_std` feature of this | |
: /// library is activated, and it is activated by default. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ```rust | |
: /// use futures::future::*; | |
: /// | |
: /// let mut future = ok::<i32, u32>(2); | |
: /// assert!(future.catch_unwind().wait().is_ok()); | |
: /// | |
: /// let mut future = lazy(|| { | |
: /// panic!(); | |
: /// ok::<i32, u32>(2) | |
: /// }); | |
: /// assert!(future.catch_unwind().wait().is_err()); | |
: /// ``` | |
: #[cfg(feature = "use_std")] | |
: fn catch_unwind(self) -> CatchUnwind<Self> | |
: where Self: Sized + ::std::panic::UnwindSafe | |
: { | |
: catch_unwind::new(self) | |
: } | |
: | |
: /// Create a cloneable handle to this future where all handles will resolve | |
: /// to the same result. | |
: /// | |
: /// The shared() method provides a mean to convert any future into a | |
: /// cloneable future. It enables a future to be polled by multiple threads. | |
: /// | |
: /// The returned `Shared` future resolves successfully with | |
: /// `SharedItem<Self::Item>` or erroneously with `SharedError<Self::Error>`. | |
: /// Both `SharedItem` and `SharedError` implements `Deref` to allow shared | |
: /// access to the underlying result. Ownership of `Self::Item` and | |
: /// `Self::Error` cannot currently be reclaimed. | |
: /// | |
: /// This method is only available when the `use_std` feature of this | |
: /// library is activated, and it is activated by default. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// use futures::future::*; | |
: /// | |
: /// let future = ok::<_, bool>(6); | |
: /// let shared1 = future.shared(); | |
: /// let shared2 = shared1.clone(); | |
: /// assert_eq!(6, *shared1.wait().unwrap()); | |
: /// assert_eq!(6, *shared2.wait().unwrap()); | |
: /// ``` | |
: /// | |
: /// ``` | |
: /// use std::thread; | |
: /// use futures::future::*; | |
: /// | |
: /// let future = ok::<_, bool>(6); | |
: /// let shared1 = future.shared(); | |
: /// let shared2 = shared1.clone(); | |
: /// let join_handle = thread::spawn(move || { | |
: /// assert_eq!(6, *shared2.wait().unwrap()); | |
: /// }); | |
: /// assert_eq!(6, *shared1.wait().unwrap()); | |
: /// join_handle.join().unwrap(); | |
: /// ``` | |
: #[cfg(feature = "use_std")] | |
: fn shared(self) -> Shared<Self> | |
: where Self: Sized | |
: { | |
: Shared::new(self) | |
: } | |
:} | |
: | |
:impl<'a, F: ?Sized + Future> Future for &'a mut F { | |
: type Item = F::Item; | |
: type Error = F::Error; | |
: | |
: fn poll(&mut self) -> Poll<Self::Item, Self::Error> { | |
: (**self).poll() | |
: } | |
:} | |
: | |
:// Just a helper function to ensure the futures we're returning all have the | |
:// right implementations. | |
:fn assert_future<A, B, F>(t: F) -> F | |
: where F: Future<Item=A, Error=B>, | |
:{ | |
: t | |
:} | |
: | |
:/// Class of types which can be converted into a future. | |
:/// | |
:/// This trait is very similar to the `IntoIterator` trait and is intended to be | |
:/// used in a very similar fashion. | |
:pub trait IntoFuture { | |
: /// The future that this type can be converted into. | |
: type Future: Future<Item=Self::Item, Error=Self::Error>; | |
: | |
: /// The item that the future may resolve with. | |
: type Item; | |
: /// The error that the future may resolve with. | |
: type Error; | |
: | |
: /// Consumes this object and produces a future. | |
: fn into_future(self) -> Self::Future; | |
:} | |
: | |
:impl<F: Future> IntoFuture for F { | |
: type Future = F; | |
: type Item = F::Item; | |
: type Error = F::Error; | |
: | |
: fn into_future(self) -> F { | |
: self | |
: } | |
:} | |
: | |
:impl<T, E> IntoFuture for result::Result<T, E> { | |
: type Future = FutureResult<T, E>; | |
: type Item = T; | |
: type Error = E; | |
: | |
: fn into_future(self) -> FutureResult<T, E> { | |
: result(self) | |
: } | |
:} | |
: | |
:/// Asynchronous conversion from a type `T`. | |
:/// | |
:/// This trait is analogous to `std::convert::From`, adapted to asynchronous | |
:/// computation. | |
:pub trait FutureFrom<T>: Sized { | |
: /// The future for the conversion. | |
: type Future: Future<Item=Self, Error=Self::Error>; | |
: | |
: /// Possible errors during conversion. | |
: type Error; | |
: | |
: /// Consume the given value, beginning the conversion. | |
: fn future_from(T) -> Self::Future; | |
:} | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/string/../sysdeps/x86_64/strlen.S" | |
* | |
* 5175 0.0543 | |
*/ | |
/* strlen total: 5175 0.0543 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/elf/dl-tls.c" | |
* | |
* 5091 0.0535 | |
*/ | |
/* _dl_allocate_tls_storage total: 2 2.1e-05 */ | |
/* _dl_allocate_tls_init total: 6 6.3e-05 */ | |
/* __tls_get_addr total: 5082 0.0534 */ | |
/* _dl_add_to_slotinfo total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/fs.rs" | |
* | |
* 5009 0.0526 | |
*/ | |
/* _$LT$std..fs..File$u20$as$u20$std..io..Read$GT$::read::h0fafe9094d6c5114 total: 2 2.1e-05 */ | |
/* _$LT$std..fs..File$u20$as$u20$std..io..Write$GT$::write::h7730a15de53eede6 total: 5495 0.0577 */ | |
/* _$LT$$RF$$u27$a$u20$std..fs..File$u20$as$u20$std..io..Read$GT$::read::h4b82b8dde9ea7e7c total: 61 6.4e-04 */ | |
/* _$LT$$RF$$u27$a$u20$std..fs..File$u20$as$u20$std..io..Write$GT$::write::h39105442ff89d9f9 total: 11 1.2e-04 */ | |
/* std::fs::OpenOptions::new::hcca82c651f055c4a total: 6 6.3e-05 */ | |
/* std::fs::OpenOptions::read::h5d1a7db4647aabbb total: 4 4.2e-05 */ | |
/* std::fs::OpenOptions::read::h5d1a7db4647aabbb total: 1 1.0e-05 */ | |
/* std::fs::OpenOptions::write::h55d0b2ae0340d76c total: 5 5.2e-05 */ | |
/* std::fs::OpenOptions::truncate::h7eb47c8bace85b35 total: 1 1.0e-05 */ | |
/* std::fs::OpenOptions::create::hfa63f8ff80b77898 total: 1 1.0e-05 */ | |
/* std::fs::OpenOptions::_open::h9034d3d740fa30f6 total: 10 1.0e-04 */ | |
/* std::fs::OpenOptions::_open::h9034d3d740fa30f6 total: 2 2.1e-05 */ | |
/* std::fs::Metadata::permissions::hb765dd6c70fe6db2 total: 1 1.0e-05 */ | |
/* _$LT$std..fs..ReadDir$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h7de13e70f3ba2caa total: 16 1.7e-04 */ | |
/* std::fs::DirEntry::path::h9d3e5fcdc94f3b5b total: 5 5.2e-05 */ | |
/* std::fs::metadata::h1635d97a3e63cefd total: 6 6.3e-05 */ | |
/* std::fs::metadata::h6a3ea96a9a9770e4 total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.6.4/src/event.rs" | |
* | |
* 4523 0.0475 | |
*/ | |
:use token::Token; | |
:use std::{fmt, ops}; | |
: | |
:/// Configures readiness polling behavior for a given `Evented` value. | |
:#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord)] | |
97 0.0010 :pub struct PollOpt(usize); | |
: | |
:impl PollOpt { | |
: #[inline] | |
: pub fn edge() -> PollOpt { | |
: PollOpt(0x020) | |
: } | |
: | |
: #[inline] | |
: pub fn empty() -> PollOpt { | |
: PollOpt(0) | |
: } | |
: | |
: #[inline] | |
: pub fn level() -> PollOpt { | |
: PollOpt(0x040) | |
: } | |
: | |
: #[inline] | |
: pub fn oneshot() -> PollOpt { | |
: PollOpt(0x080) | |
: } | |
: | |
: #[inline] | |
: pub fn urgent() -> PollOpt { | |
: PollOpt(0x100) | |
: } | |
: | |
: #[inline] | |
: pub fn all() -> PollOpt { | |
: PollOpt::edge() | PollOpt::level() | PollOpt::oneshot() | |
: } | |
: | |
: #[inline] | |
: pub fn is_edge(&self) -> bool { | |
: self.contains(PollOpt::edge()) | |
: } | |
: | |
: #[inline] | |
: pub fn is_level(&self) -> bool { | |
: self.contains(PollOpt::level()) | |
: } | |
: | |
: #[inline] | |
: pub fn is_oneshot(&self) -> bool { | |
: self.contains(PollOpt::oneshot()) | |
: } | |
: | |
: #[inline] | |
: pub fn is_urgent(&self) -> bool { | |
: self.contains(PollOpt::urgent()) | |
: } | |
: | |
: #[inline] | |
: pub fn bits(&self) -> usize { | |
: self.0 | |
: } | |
: | |
: #[inline] | |
: pub fn contains(&self, other: PollOpt) -> bool { | |
: (*self & other) == other | |
: } | |
: | |
: #[inline] | |
: pub fn insert(&mut self, other: PollOpt) { | |
: self.0 |= other.0; | |
: } | |
: | |
: #[inline] | |
: pub fn remove(&mut self, other: PollOpt) { | |
: self.0 &= !other.0; | |
: } | |
:} | |
: | |
:impl ops::BitOr for PollOpt { | |
: type Output = PollOpt; | |
: | |
: #[inline] | |
: fn bitor(self, other: PollOpt) -> PollOpt { | |
: PollOpt(self.bits() | other.bits()) | |
: } | |
:} | |
: | |
:impl ops::BitXor for PollOpt { | |
: type Output = PollOpt; | |
: | |
: #[inline] | |
: fn bitxor(self, other: PollOpt) -> PollOpt { | |
: PollOpt(self.bits() ^ other.bits()) | |
: } | |
:} | |
: | |
:impl ops::BitAnd for PollOpt { | |
: type Output = PollOpt; | |
: | |
: #[inline] | |
: fn bitand(self, other: PollOpt) -> PollOpt { | |
: PollOpt(self.bits() & other.bits()) | |
: } | |
:} | |
: | |
:impl ops::Sub for PollOpt { | |
: type Output = PollOpt; | |
: | |
: #[inline] | |
: fn sub(self, other: PollOpt) -> PollOpt { | |
: PollOpt(self.bits() & !other.bits()) | |
: } | |
:} | |
: | |
:impl ops::Not for PollOpt { | |
: type Output = PollOpt; | |
: | |
: #[inline] | |
: fn not(self) -> PollOpt { | |
: PollOpt(!self.bits() & PollOpt::all().bits()) | |
: } | |
:} | |
: | |
:impl fmt::Debug for PollOpt { | |
: fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
: let mut one = false; | |
: let flags = [ | |
: (PollOpt::edge(), "Edge-Triggered"), | |
: (PollOpt::level(), "Level-Triggered"), | |
: (PollOpt::oneshot(), "OneShot")]; | |
: | |
: for &(flag, msg) in &flags { | |
: if self.contains(flag) { | |
: if one { try!(write!(fmt, " | ")) } | |
: try!(write!(fmt, "{}", msg)); | |
: | |
: one = true | |
: } | |
: } | |
: | |
: Ok(()) | |
: } | |
:} | |
: | |
:/// A set of readiness events returned by `Poll`. | |
:#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord)] | |
988 0.0104 :pub struct Ready(usize); | |
: | |
:impl Ready { | |
604 0.0063 : pub fn none() -> Ready { /* mio::event::Ready::none::had160a5967eeafd7 total: 762 0.0080 */ | |
: Ready(0) | |
158 0.0017 : } | |
: | |
: #[inline] | |
: pub fn readable() -> Ready { | |
: Ready(0x001) | |
: } | |
: | |
: #[inline] | |
: pub fn writable() -> Ready { | |
: Ready(0x002) | |
: } | |
: | |
: #[inline] | |
: pub fn error() -> Ready { | |
: Ready(0x004) | |
: } | |
: | |
: #[inline] | |
: pub fn hup() -> Ready { | |
: Ready(0x008) | |
: } | |
: | |
: // Private | |
: #[inline] | |
: fn drop() -> Ready { | |
: Ready(0x10) | |
: } | |
: | |
: #[inline] | |
: pub fn all() -> Ready { | |
: Ready::readable() | | |
: Ready::writable() | | |
: Ready::hup() | | |
: Ready::error() | |
: } | |
: | |
: #[inline] | |
: pub fn is_none(&self) -> bool { | |
: (*self & !Ready::drop()) == Ready::none() | |
: } | |
: | |
: #[inline] | |
: pub fn is_readable(&self) -> bool { | |
: self.contains(Ready::readable()) | |
: } | |
: | |
: #[inline] | |
: pub fn is_writable(&self) -> bool { | |
: self.contains(Ready::writable()) | |
: } | |
: | |
: #[inline] | |
: pub fn is_error(&self) -> bool { | |
: self.contains(Ready::error()) | |
: } | |
: | |
: #[inline] | |
: pub fn is_hup(&self) -> bool { | |
: self.contains(Ready::hup()) | |
: } | |
: | |
: #[inline] | |
: pub fn insert(&mut self, other: Ready) { | |
: self.0 |= other.0; | |
: } | |
: | |
: #[inline] | |
: pub fn remove(&mut self, other: Ready) { | |
: self.0 &= !other.0; | |
: } | |
: | |
: #[inline] | |
: pub fn bits(&self) -> usize { | |
: self.0 | |
: } | |
: | |
: #[inline] | |
: pub fn contains(&self, other: Ready) -> bool { | |
: (*self & other) == other | |
: } | |
:} | |
: | |
:impl ops::BitOr for Ready { | |
: type Output = Ready; | |
: | |
: #[inline] | |
: fn bitor(self, other: Ready) -> Ready { | |
76 8.0e-04 : Ready(self.bits() | other.bits()) | |
: } | |
:} | |
: | |
:impl ops::BitXor for Ready { | |
: type Output = Ready; | |
: | |
: #[inline] | |
: fn bitxor(self, other: Ready) -> Ready { | |
: Ready(self.bits() ^ other.bits()) | |
: } | |
:} | |
: | |
:impl ops::BitAnd for Ready { | |
: type Output = Ready; | |
: | |
: #[inline] | |
: fn bitand(self, other: Ready) -> Ready { | |
9 9.4e-05 : Ready(self.bits() & other.bits()) | |
: } | |
:} | |
: | |
:impl ops::Sub for Ready { | |
: type Output = Ready; | |
: | |
: #[inline] | |
: fn sub(self, other: Ready) -> Ready { | |
: Ready(self.bits() & !other.bits()) | |
: } | |
:} | |
: | |
:impl ops::Not for Ready { | |
: type Output = Ready; | |
: | |
: #[inline] | |
: fn not(self) -> Ready { | |
: Ready(!self.bits() & Ready::all().bits()) | |
: } | |
:} | |
: | |
:impl fmt::Debug for Ready { | |
: fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
: let mut one = false; | |
: let flags = [ | |
: (Ready::readable(), "Readable"), | |
: (Ready::writable(), "Writable"), | |
: (Ready::error(), "Error"), | |
: (Ready::hup(), "Hup"), | |
: (Ready::drop(), "Drop")]; | |
: | |
: try!(write!(fmt, "Ready {{")); | |
: | |
: for &(flag, msg) in &flags { | |
: if self.contains(flag) { | |
: if one { try!(write!(fmt, " | ")) } | |
: try!(write!(fmt, "{}", msg)); | |
: | |
: one = true | |
: } | |
: } | |
: | |
: try!(write!(fmt, "}}")); | |
: | |
: Ok(()) | |
: } | |
:} | |
: | |
:/// An readiness event returned by `Poll`. | |
:/// | |
:/// Event represents the raw event that the OS-specific selector | |
:/// returned. An event can represent more than one kind (such as | |
:/// readable or writable) at a time. | |
:/// | |
:/// These Event objects are created by the OS-specific concrete | |
:/// Selector when they have events to report. | |
:#[derive(Copy, Clone, Eq, PartialEq, Debug)] | |
:pub struct Event { | |
: kind: Ready, | |
: token: Token | |
:} | |
: | |
:impl Event { | |
: /// Create a new Event. | |
: pub fn new(kind: Ready, token: Token) -> Event { | |
: Event { | |
: kind: kind, | |
: token: token, | |
: } | |
: } | |
: | |
903 0.0095 : pub fn kind(&self) -> Ready { /* mio::event::Event::kind::heb69c24d1e8d56f7 total: 1187 0.0125 */ | |
24 2.5e-04 : self.kind | |
260 0.0027 : } | |
: | |
1045 0.0110 : pub fn token(&self) -> Token { /* mio::event::Event::token::hc7cde33b44aac9ad total: 1404 0.0147 */ | |
20 2.1e-04 : self.token | |
339 0.0036 : } | |
:} | |
: | |
:/* | |
: * | |
: * ===== Mio internal helpers ===== | |
: * | |
: */ | |
: | |
:pub fn as_usize(events: Ready) -> usize { | |
: events.0 | |
:} | |
: | |
:pub fn from_usize(events: usize) -> Ready { | |
: Ready(events) | |
:} | |
: | |
:/// Returns true if the `Ready` does not have any public OR private flags | |
:/// set. | |
:pub fn is_empty(events: Ready) -> bool { | |
: events.0 == 0 | |
:} | |
: | |
:pub fn is_drop(events: Ready) -> bool { | |
: events.contains(Ready::drop()) | |
:} | |
: | |
:pub fn drop() -> Ready { | |
: Ready::drop() | |
:} | |
: | |
:// Used internally to mutate an `Event` in place | |
:// Not used on all platforms | |
:#[allow(dead_code)] | |
:pub fn kind_mut(event: &mut Event) -> &mut Ready { | |
: &mut event.kind | |
:} | |
/* | |
* Total samples for file : "SimplifyCFG.cpp" | |
* | |
* 4396 0.0462 | |
*/ | |
<credited to line zero> 4396 0.0462 : | |
/* CasesAreContiguous(llvm::SmallVectorImpl<llvm::ConstantInt*>&) total: 6 6.3e-05 */ | |
/* FindPHIForConditionForwarding(llvm::ConstantInt*, llvm::BasicBlock*, int*) total: 16 1.7e-04 */ | |
/* SimplifySwitchOnSelect(llvm::SwitchInst*, llvm::SelectInst*) total: 6 6.3e-05 */ | |
/* TurnSwitchRangeIntoICmp(llvm::SwitchInst*, llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&) total: 66 6.9e-04 */ | |
/* EliminateDeadSwitchCases(llvm::SwitchInst*, llvm::AssumptionCache*, llvm::DataLayout const&) total: 105 0.0011 */ | |
/* ValidLookupTableConstant(llvm::Constant*) total: 3 3.1e-05 */ | |
/* LookupConstant(llvm::Value*, llvm::SmallDenseMap<llvm::Value*, llvm::Constant*, 4u, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, llvm::Constant*> > const&) total: 6 6.3e-05 */ | |
/* ConstantFold(llvm::Instruction*, llvm::DataLayout const&, llvm::SmallDenseMap<llvm::Value*, llvm::Constant*, 4u, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::Value*, llvm::Constant*> > const&) total: 26 2.7e-04 */ | |
/* (anonymous namespace)::SimplifyCFGOpt::SimplifyUnreachable(llvm::UnreachableInst*) [clone .isra.799] total: 102 0.0011 */ | |
/* GetCaseResults(llvm::SwitchInst*, llvm::ConstantInt*, llvm::BasicBlock*, llvm::BasicBlock**, llvm::SmallVectorImpl<std::pair<llvm::PHINode*, llvm::Constant*> >&, llvm::DataLayout const&) total: 70 7.3e-04 */ | |
/* InitializeUniqueCases(llvm::SwitchInst*, llvm::PHINode*&, llvm::BasicBlock*&, llvm::SmallVector<std::pair<llvm::Constant*, llvm::SmallVector<llvm::ConstantInt*, 4u> >, 2u>&, llvm::Constant*&, llvm::DataLayout const&) total: 36 3.8e-04 */ | |
/* ForwardSwitchConditionToPHI(llvm::SwitchInst*) total: 50 5.2e-04 */ | |
/* SwitchToLookupTable(llvm::SwitchInst*, llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, llvm::DataLayout const&, llvm::TargetTransformInfo const&) total: 32 3.4e-04 */ | |
/* (anonymous namespace)::SimplifyCFGOpt::SimplifySwitch(llvm::SwitchInst*, llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&) total: 49 5.1e-04 */ | |
/* ConstantIntSortPredicate(llvm::ConstantInt* const*, llvm::ConstantInt* const*) total: 3 3.1e-05 */ | |
/* extractPredSuccWeights(llvm::BranchInst*, llvm::BranchInst*, unsigned long&, unsigned long&, unsigned long&, unsigned long&) total: 3 3.1e-05 */ | |
/* EliminateBlockCases(llvm::BasicBlock*, std::vector<(anonymous namespace)::ValueEqualityComparisonCase, std::allocator<(anonymous namespace)::ValueEqualityComparisonCase> >&) total: 1 1.0e-05 */ | |
/* ComputeSpeculationCost(llvm::User const*, llvm::TargetTransformInfo const&) total: 27 2.8e-04 */ | |
/* llvm::SmallDenseMap<std::pair<llvm::Value*, llvm::Value*>, llvm::PHINode*, 4u, llvm::DenseMapInfo<std::pair<llvm::Value*, llvm::Value*> >, llvm::detail::DenseMapPair<std::pair<llvm::Value*, llvm::Value*>, llvm::PHINode*> >::allocateBuckets(unsigned int) [clone .isra.347] total: 4 4.2e-05 */ | |
/* void std::__advance<llvm::ilist_iterator<llvm::Instruction>, long>(llvm::ilist_iterator<llvm::Instruction>&, long, std::bidirectional_iterator_tag) [clone .isra.353] total: 55 5.8e-04 */ | |
/* std::reverse_iterator<llvm::ilist_iterator<llvm::Instruction> >::operator*() const [clone .isra.316] total: 23 2.4e-04 */ | |
/* std::iterator_traits<llvm::PredIterator<llvm::BasicBlock, llvm::Value::user_iterator_impl<llvm::User> > >::difference_type std::__distance<llvm::PredIterator<llvm::BasicBlock, llvm::Value::user_iterator_impl<llvm::User> > >(llvm::PredIterator<llvm::BasicBlock, llvm::Value::user_iterator_impl<llvm::User> >, llvm::PredIterator<llvm::BasicBlock, llvm::Value::user_iterator_impl<llvm::User> >, std::input_iterator_tag) [clone .isra.796] total: 22 2.3e-04 */ | |
/* mergeConditionalStores(llvm::BranchInst*, llvm::BranchInst*)::{lambda(llvm::BasicBlock*, llvm::BasicBlock*, llvm::BasicBlock*)#1}::operator()(llvm::BasicBlock*, llvm::BasicBlock*, llvm::BasicBlock*) const [clone .isra.40] total: 12 1.3e-04 */ | |
/* llvm::SwitchInst::CaseIteratorT<llvm::SwitchInst, llvm::ConstantInt, llvm::BasicBlock>::getCaseValue() [clone .isra.693] total: 28 2.9e-04 */ | |
/* void llvm::SmallPtrSetImpl<llvm::BasicBlock*>::insert<llvm::TerminatorInst::SuccIterator<llvm::TerminatorInst*, llvm::BasicBlock> >(llvm::TerminatorInst::SuccIterator<llvm::TerminatorInst*, llvm::BasicBlock>, llvm::TerminatorInst::SuccIterator<llvm::TerminatorInst*, llvm::BasicBlock>) [clone .isra.285] total: 21 2.2e-04 */ | |
/* AddPredecessorToBlock(llvm::BasicBlock*, llvm::BasicBlock*, llvm::BasicBlock*) total: 3 3.1e-05 */ | |
/* llvm::APInt::getLimitedValue(unsigned long) const [clone .constprop.898] total: 1 1.0e-05 */ | |
/* llvm::SwitchInst::CaseIteratorT<llvm::SwitchInst, llvm::ConstantInt, llvm::BasicBlock>::getCaseSuccessor() [clone .isra.691] total: 13 1.4e-04 */ | |
/* SafeToMergeTerminators(llvm::TerminatorInst*, llvm::TerminatorInst*) total: 54 5.7e-04 */ | |
/* llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::IRBuilder(llvm::Instruction*, llvm::MDNode*, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >) [clone .constprop.873] total: 11 1.2e-04 */ | |
/* llvm::BranchInst::getSuccessor(unsigned int) const [clone .constprop.892] total: 86 9.0e-04 */ | |
/* llvm::BranchInst::getSuccessor(unsigned int) const [clone .constprop.893] total: 57 6.0e-04 */ | |
/* BlockIsSimpleEnoughToThreadThrough(llvm::BasicBlock*) total: 3 3.1e-05 */ | |
/* DominatesMergePoint(llvm::Value*, llvm::BasicBlock*, llvm::SmallPtrSetImpl<llvm::Instruction*>*, unsigned int&, llvm::TargetTransformInfo const&, unsigned int) [clone .part.562] total: 100 0.0010 */ | |
/* GetConstantInt(llvm::Value*, llvm::DataLayout const&) total: 246 0.0026 */ | |
/* (anonymous namespace)::SimplifyCFGOpt::GetValueEqualityComparisonCases(llvm::TerminatorInst*, std::vector<(anonymous namespace)::ValueEqualityComparisonCase, std::allocator<(anonymous namespace)::ValueEqualityComparisonCase> >&) [clone .isra.715] total: 1 1.0e-05 */ | |
/* HasBranchWeights(llvm::Instruction const*) total: 17 1.8e-04 */ | |
/* TryToMergeLandingPad(llvm::LandingPadInst*, llvm::BranchInst*, llvm::BasicBlock*) total: 11 1.2e-04 */ | |
/* (anonymous namespace)::SimplifyCFGOpt::isValueEqualityComparison(llvm::TerminatorInst*) [clone .isra.797] total: 417 0.0044 */ | |
/* (anonymous namespace)::SimplifyCFGOpt::SimplifyEqualityComparisonWithOnlyPredecessor(llvm::TerminatorInst*, llvm::BasicBlock*, llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&) total: 40 4.2e-04 */ | |
/* (anonymous namespace)::SimplifyCFGOpt::SimplifyResume(llvm::ResumeInst*, llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&) [clone .isra.804] total: 55 5.8e-04 */ | |
/* FoldTwoEntryPHINode(llvm::PHINode*, llvm::TargetTransformInfo const&, llvm::DataLayout const&) total: 82 8.6e-04 */ | |
/* mergeConditionalStores(llvm::BranchInst*, llvm::BranchInst*) total: 258 0.0027 */ | |
/* SimplifyCondBranchToCondBranch(llvm::BranchInst*, llvm::BranchInst*, llvm::DataLayout const&) [clone .isra.800] total: 249 0.0026 */ | |
/* passingValueIsAlwaysUndefined(llvm::Value*, llvm::Instruction*) total: 198 0.0021 */ | |
/* (anonymous namespace)::ConstantComparesGatherer::matchInstruction(llvm::Instruction*, bool) total: 378 0.0040 */ | |
/* HoistThenElseCodeToIf(llvm::BranchInst*, llvm::TargetTransformInfo const&) total: 346 0.0036 */ | |
/* (anonymous namespace)::SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(llvm::TerminatorInst*, llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&) total: 24 2.5e-04 */ | |
/* SinkThenElseCodeToEnd(llvm::BranchInst*) total: 512 0.0054 */ | |
/* SpeculativelyExecuteBB(llvm::BranchInst*, llvm::BasicBlock*, llvm::TargetTransformInfo const&) total: 452 0.0047 */ | |
/* FoldCondBranchOnPHI(llvm::BranchInst*, llvm::DataLayout const&) total: 10 1.0e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/liballoc_jemalloc/../jemalloc/src/tcache.c" | |
* | |
* 4391 0.0461 | |
*/ | |
/* je_tcache_event_hard total: 803 0.0084 */ | |
/* je_tcache_event_hard total: 1227 0.0129 */ | |
/* je_tcache_alloc_small_hard total: 6 6.3e-05 */ | |
/* je_tcache_alloc_small_hard total: 401 0.0042 */ | |
/* je_tcache_bin_flush_small total: 199 0.0021 */ | |
/* je_tcache_bin_flush_small total: 2672 0.0281 */ | |
/* je_tcache_bin_flush_large total: 38 4.0e-04 */ | |
/* je_tcache_get_hard total: 1 1.0e-05 */ | |
/* je_tcache_get_hard total: 1 1.0e-05 */ | |
/* je_tcache_create total: 1 1.0e-05 */ | |
/* tcache_destroy total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "Function.cpp" | |
* | |
* 4161 0.0437 | |
*/ | |
<credited to line zero> 4161 0.0437 : | |
/* __gnu_cxx::__exchange_and_add_dispatch(int*, int) [clone .constprop.257] total: 419 0.0044 */ | |
/* DecodeFixedType(llvm::ArrayRef<llvm::Intrinsic::IITDescriptor>&, llvm::ArrayRef<llvm::Type*>, llvm::LLVMContext&) total: 885 0.0093 */ | |
/* getMangledTypeStr(llvm::Type*) total: 238 0.0025 */ | |
/* DecodeIITType(unsigned int&, llvm::ArrayRef<unsigned char>, llvm::SmallVectorImpl<llvm::Intrinsic::IITDescriptor>&) total: 2619 0.0275 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.6.4/src/sys/unix/epoll.rs" | |
* | |
* 4049 0.0425 | |
*/ | |
:use std::os::unix::io::RawFd; | |
:use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; | |
:use std::time::Duration; | |
:use std::{cmp, i32}; | |
: | |
:use libc::c_int; | |
:use libc; | |
:use libc::{EPOLLERR, EPOLLHUP, EPOLLRDHUP, EPOLLONESHOT}; | |
:use libc::{EPOLLET, EPOLLOUT, EPOLLIN, EPOLLPRI}; | |
: | |
:use {convert, io, Ready, PollOpt, Token}; | |
:use event::Event; | |
:use sys::unix::cvt; | |
:use sys::unix::io::set_cloexec; | |
: | |
:/// Each Selector has a globally unique(ish) ID associated with it. This ID | |
:/// gets tracked by `TcpStream`, `TcpListener`, etc... when they are first | |
:/// registered with the `Selector`. If a type that is previously associated with | |
:/// a `Selector` attempts to register itself with a different `Selector`, the | |
:/// operation will return with an error. This matches windows behavior. | |
:static NEXT_ID: AtomicUsize = ATOMIC_USIZE_INIT; | |
: | |
:#[derive(Debug)] | |
:pub struct Selector { | |
: id: usize, | |
: epfd: RawFd, | |
:} | |
: | |
:impl Selector { | |
: pub fn new() -> io::Result<Selector> { | |
: let epfd = unsafe { | |
: // Emulate `epoll_create` by using `epoll_create1` if it's available | |
: // and otherwise falling back to `epoll_create` followed by a call to | |
: // set the CLOEXEC flag. | |
: dlsym!(fn epoll_create1(c_int) -> c_int); | |
: | |
: match epoll_create1.get() { | |
: Some(epoll_create1_fn) => { | |
: try!(cvt(epoll_create1_fn(libc::EPOLL_CLOEXEC))) | |
: } | |
: None => { | |
: let fd = try!(cvt(libc::epoll_create(1024))); | |
: drop(set_cloexec(fd)); | |
: fd | |
: } | |
: } | |
: }; | |
: | |
: // offset by 1 to avoid choosing 0 as the id of a selector | |
: let id = NEXT_ID.fetch_add(1, Ordering::Relaxed) + 1; | |
: | |
: Ok(Selector { | |
: id: id, | |
: epfd: epfd, | |
: }) | |
: } | |
: | |
: pub fn id(&self) -> usize { | |
: self.id | |
: } | |
: | |
: /// Wait for events from the OS | |
: pub fn select(&self, evts: &mut Events, awakener: Token, timeout: Option<Duration>) -> io::Result<bool> { | |
: let timeout_ms = timeout | |
: .map(|to| cmp::min(convert::millis(to), i32::MAX as u64) as i32) | |
: .unwrap_or(-1); | |
: | |
: // Wait for epoll events for at most timeout_ms milliseconds | |
: unsafe { | |
: evts.events.set_len(0); | |
931 0.0098 : let cnt = try!(cvt(libc::epoll_wait(self.epfd, | |
: evts.events.as_mut_ptr(), | |
: evts.events.capacity() as i32, | |
: timeout_ms))); | |
174 0.0018 : let cnt = cnt as usize; | |
: evts.events.set_len(cnt); | |
: | |
257 0.0027 : for i in 0..cnt { | |
4 4.2e-05 : if evts.events[i].u64 as usize == awakener.into() { | |
: evts.events.remove(i); | |
: return Ok(true); | |
: } | |
: } | |
: } | |
: | |
: Ok(false) | |
: } | |
: | |
: /// Register event interests for the given IO handle with the OS | |
: pub fn register(&self, fd: RawFd, token: Token, interests: Ready, opts: PollOpt) -> io::Result<()> { | |
: let mut info = libc::epoll_event { | |
: events: ioevent_to_epoll(interests, opts), | |
: u64: usize::from(token) as u64 | |
: }; | |
: | |
: unsafe { | |
: try!(cvt(libc::epoll_ctl(self.epfd, libc::EPOLL_CTL_ADD, fd, &mut info))); | |
: Ok(()) | |
: } | |
: } | |
: | |
: /// Register event interests for the given IO handle with the OS | |
: pub fn reregister(&self, fd: RawFd, token: Token, interests: Ready, opts: PollOpt) -> io::Result<()> { | |
: let mut info = libc::epoll_event { | |
: events: ioevent_to_epoll(interests, opts), | |
: u64: usize::from(token) as u64 | |
: }; | |
: | |
: unsafe { | |
: try!(cvt(libc::epoll_ctl(self.epfd, libc::EPOLL_CTL_MOD, fd, &mut info))); | |
: Ok(()) | |
: } | |
: } | |
: | |
: /// Deregister event interests for the given IO handle with the OS | |
: pub fn deregister(&self, fd: RawFd) -> io::Result<()> { | |
: // The &info argument should be ignored by the system, | |
: // but linux < 2.6.9 required it to be not null. | |
: // For compatibility, we provide a dummy EpollEvent. | |
: let mut info = libc::epoll_event { | |
: events: 0, | |
: u64: 0, | |
: }; | |
: | |
: unsafe { | |
: try!(cvt(libc::epoll_ctl(self.epfd, libc::EPOLL_CTL_DEL, fd, &mut info))); | |
: Ok(()) | |
: } | |
: } | |
:} | |
: | |
:fn ioevent_to_epoll(interest: Ready, opts: PollOpt) -> u32 { | |
: let mut kind = 0; | |
: | |
263 0.0028 : if interest.is_readable() { | |
: if opts.is_urgent() { | |
: kind |= EPOLLPRI; | |
: } else { | |
: kind |= EPOLLIN; | |
: } | |
: } | |
: | |
17 1.8e-04 : if interest.is_writable() { | |
: kind |= EPOLLOUT; | |
: } | |
: | |
100 0.0010 : if interest.is_hup() { | |
: kind |= EPOLLRDHUP; | |
: } | |
: | |
119 0.0012 : if opts.is_edge() { | |
: kind |= EPOLLET; | |
: } | |
: | |
: if opts.is_oneshot() { | |
: kind |= EPOLLONESHOT; | |
: } | |
: | |
: if opts.is_level() { | |
: kind &= !EPOLLET; | |
: } | |
: | |
: kind as u32 | |
:} | |
: | |
:impl Drop for Selector { | |
: fn drop(&mut self) { | |
: unsafe { | |
: let _ = libc::close(self.epfd); | |
: } | |
: } | |
:} | |
: | |
:pub struct Events { | |
: events: Vec<libc::epoll_event>, | |
:} | |
: | |
:impl Events { | |
: pub fn with_capacity(u: usize) -> Events { | |
: Events { | |
: events: Vec::with_capacity(u) | |
: } | |
: } | |
: | |
: #[inline] | |
: pub fn len(&self) -> usize { | |
: self.events.len() | |
: } | |
: | |
: #[inline] | |
: pub fn is_empty(&self) -> bool { | |
: self.events.is_empty() | |
: } | |
: | |
: #[inline] | |
: pub fn get(&self, idx: usize) -> Option<Event> { | |
538 0.0056 : self.events.get(idx).map(|event| { | |
: let epoll = event.events as c_int; | |
: let mut kind = Ready::none(); | |
: | |
735 0.0077 : if (epoll & EPOLLIN) != 0 || (epoll & EPOLLPRI) != 0 { | |
: kind = kind | Ready::readable(); | |
: } | |
: | |
300 0.0031 : if (epoll & EPOLLOUT) != 0 { | |
: kind = kind | Ready::writable(); | |
: } | |
: | |
: // EPOLLHUP - Usually means a socket error happened | |
102 0.0011 : if (epoll & EPOLLERR) != 0 { | |
: kind = kind | Ready::error(); | |
: } | |
: | |
398 0.0042 : if (epoll & EPOLLRDHUP) != 0 || (epoll & EPOLLHUP) != 0 { | |
: kind = kind | Ready::hup(); | |
: } | |
: | |
111 0.0012 : let token = self.events[idx].u64; | |
: | |
: Event::new(kind, Token(token as usize)) | |
: }) | |
: } | |
: | |
: pub fn push_event(&mut self, event: Event) { | |
: self.events.push(libc::epoll_event { | |
: events: ioevent_to_epoll(event.kind(), PollOpt::empty()), | |
: u64: usize::from(event.token()) as u64 | |
: }); | |
: } | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/poll.rs" | |
* | |
* 4036 0.0424 | |
*/ | |
:/// A macro for extracting the successful type of a `Poll<T, E>`. | |
:/// | |
:/// This macro bakes propagation of both errors and `NotReady` signals by | |
:/// returning early. | |
:#[macro_export] | |
:macro_rules! try_ready { | |
: ($e:expr) => (match $e { | |
1401 0.0147 : Ok($crate::Async::Ready(t)) => t, | |
: Ok($crate::Async::NotReady) => return Ok($crate::Async::NotReady), | |
219 0.0023 : Err(e) => return Err(From::from(e)), | |
: }) | |
:} | |
: | |
:/// Return type of the `Future::poll` method, indicates whether a future's value | |
:/// is ready or not. | |
:/// | |
:/// * `Ok(Async::Ready(t))` means that a future has successfully resolved | |
:/// * `Ok(Async::NotReady)` means that a future is not ready to complete yet | |
:/// * `Err(e)` means that a future has completed with the given failure | |
:pub type Poll<T, E> = Result<Async<T>, E>; | |
: | |
:/// Return type of future, indicating whether a value is ready or not. | |
:#[derive(Copy, Clone, Debug, PartialEq)] | |
:pub enum Async<T> { | |
: /// Represents that a value is immediately ready. | |
: Ready(T), | |
: | |
: /// Represents that a value is not ready yet, but may be so later. | |
: NotReady, | |
:} | |
: | |
:impl<T> Async<T> { | |
: /// Change the success type of this `Async` value with the closure provided | |
705 0.0074 : pub fn map<F, U>(self, f: F) -> Async<U> | |
: where F: FnOnce(T) -> U | |
: { | |
: match self { | |
806 0.0085 : Async::Ready(t) => Async::Ready(f(t)), | |
: Async::NotReady => Async::NotReady, | |
: } | |
: } | |
: | |
: /// Returns whether this is `Async::Ready` | |
: pub fn is_ready(&self) -> bool { | |
: match *self { | |
905 0.0095 : Async::Ready(_) => true, | |
: Async::NotReady => false, | |
: } | |
: } | |
: | |
: /// Returns whether this is `Async::NotReady` | |
: pub fn is_not_ready(&self) -> bool { | |
: !self.is_ready() | |
: } | |
:} | |
: | |
:impl<T> From<T> for Async<T> { | |
: fn from(t: T) -> Async<T> { | |
: Async::Ready(t) | |
: } | |
:} | |
: | |
:/// The result of an asynchronous attempt to send a value to a sink. | |
:#[derive(Copy, Clone, Debug, PartialEq)] | |
:pub enum AsyncSink<T> { | |
: /// The `start_send` attempt succeeded, so the sending process has | |
: /// *started*; you muse use `Sink::poll_complete` to drive the send | |
: /// to completion. | |
: Ready, | |
: | |
: /// The `start_send` attempt failed due to the sink being full. The value | |
: /// being sent is returned, and the current `Task` will be automatically | |
: /// notified again once the sink has room. | |
: NotReady(T), | |
:} | |
: | |
:impl<T> AsyncSink<T> { | |
: /// Returns whether this is `AsyncSink::Ready` | |
: pub fn is_ready(&self) -> bool { | |
: match *self { | |
: AsyncSink::Ready => true, | |
: AsyncSink::NotReady(_) => false, | |
: } | |
: } | |
: | |
: /// Returns whether this is `AsyncSink::NotReady` | |
: pub fn is_not_ready(&self) -> bool { | |
: !self.is_ready() | |
: } | |
:} | |
: | |
: | |
:/// Return type of the `Sink::start_send` method, indicating the outcome of a | |
:/// send attempt. See `AsyncSink` for more details. | |
:pub type StartSend<T, E> = Result<AsyncSink<T>, E>; | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/future/chain.rs" | |
* | |
* 3973 0.0417 | |
*/ | |
:use core::mem; | |
: | |
:use {Future, Poll, Async}; | |
: | |
:pub enum Chain<A, B, C> where A: Future { | |
: First(A, C), | |
: Second(B), | |
: Done, | |
:} | |
: | |
:impl<A, B, C> Chain<A, B, C> | |
: where A: Future, | |
: B: Future, | |
:{ | |
: pub fn new(a: A, c: C) -> Chain<A, B, C> { | |
: Chain::First(a, c) | |
: } | |
: | |
: pub fn poll<F>(&mut self, f: F) -> Poll<B::Item, B::Error> | |
: where F: FnOnce(Result<A::Item, A::Error>, C) | |
: -> Result<Result<B::Item, B>, B::Error>, | |
: { | |
: let a_result = match *self { | |
934 0.0098 : Chain::First(ref mut a, _) => { | |
665 0.0070 : match a.poll() { | |
1215 0.0128 : Ok(Async::NotReady) => return Ok(Async::NotReady), | |
: Ok(Async::Ready(t)) => Ok(t), | |
: Err(e) => Err(e), | |
: } | |
: } | |
1146 0.0120 : Chain::Second(ref mut b) => return b.poll(), | |
: Chain::Done => panic!("cannot poll a chained future twice"), | |
: }; | |
: let data = match mem::replace(self, Chain::Done) { | |
: Chain::First(_, c) => c, | |
: _ => panic!(), | |
: }; | |
: match try!(f(a_result, data)) { | |
: Ok(e) => Ok(Async::Ready(e)), | |
1 1.0e-05 : Err(mut b) => { | |
: let ret = b.poll(); | |
9 9.4e-05 : *self = Chain::Second(b); | |
3 3.1e-05 : ret | |
: } | |
: } | |
: } | |
:} | |
/* | |
* Total samples for file : "MemoryBuiltins.cpp" | |
* | |
* 3959 0.0416 | |
*/ | |
<credited to line zero> 3959 0.0416 : | |
/* llvm::ObjectSizeOffsetVisitor::unknown() [clone .isra.49] total: 16 1.7e-04 */ | |
/* bool llvm::InvokeInst::hasFnAttrImpl<llvm::Attribute::AttrKind>(llvm::Attribute::AttrKind) const [clone .part.246] total: 359 0.0038 */ | |
/* llvm::ObjectSizeOffsetVisitor::visitCallSite(llvm::CallSite)::{lambda(llvm::APInt&)#1}::operator()(llvm::APInt&) const [clone .part.77] total: 6 6.3e-05 */ | |
/* getSizeWithOverflow(std::pair<llvm::APInt, llvm::APInt> const&) total: 103 0.0011 */ | |
/* getAllocationData(llvm::Value const*, AllocType, llvm::TargetLibraryInfo const*, bool) total: 3475 0.0365 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.4/src/net/tcp.rs" | |
* | |
* 3952 0.0415 | |
*/ | |
:use std::fmt; | |
:use std::io::{self, Read, Write}; | |
:use std::mem; | |
:use std::net::{self, SocketAddr, Shutdown}; | |
: | |
:use futures::stream::Stream; | |
:use futures::sync::oneshot; | |
:use futures::{Future, Poll, Async}; | |
:use mio; | |
: | |
:use io::{Io, IoFuture}; | |
:use reactor::{Handle, PollEvented}; | |
: | |
:/// An I/O object representing a TCP socket listening for incoming connections. | |
:/// | |
:/// This object can be converted into a stream of incoming connections for | |
:/// various forms of processing. | |
:pub struct TcpListener { | |
: io: PollEvented<mio::tcp::TcpListener>, | |
: pending_accept: Option<oneshot::Receiver<io::Result<(TcpStream, SocketAddr)>>>, | |
:} | |
: | |
:/// Stream returned by the `TcpListener::incoming` function representing the | |
:/// stream of sockets received from a listener. | |
:pub struct Incoming { | |
: inner: TcpListener, | |
:} | |
: | |
:impl TcpListener { | |
: /// Create a new TCP listener associated with this event loop. | |
: /// | |
: /// The TCP listener will bind to the provided `addr` address, if available. | |
: /// If the result is `Ok`, the socket has successfully bound. | |
: pub fn bind(addr: &SocketAddr, handle: &Handle) -> io::Result<TcpListener> { | |
: let l = try!(mio::tcp::TcpListener::bind(addr)); | |
: TcpListener::new(l, handle) | |
: } | |
: | |
: /// Attempt to accept a connection and create a new connected `TcpStream` if | |
: /// successful. | |
: /// | |
: /// This function will attempt an accept operation, but will not block | |
: /// waiting for it to complete. If the operation would block then a "would | |
: /// block" error is returned. Additionally, if this method would block, it | |
: /// registers the current task to receive a notification when it would | |
: /// otherwise not block. | |
: /// | |
: /// Note that typically for simple usage it's easier to treat incoming | |
: /// connections as a `Stream` of `TcpStream`s with the `incoming` method | |
: /// below. | |
: /// | |
: /// # Panics | |
: /// | |
: /// This function will panic if it is called outside the context of a | |
: /// future's task. It's recommended to only call this from the | |
: /// implementation of a `Future::poll`, if necessary. | |
: pub fn accept(&mut self) -> io::Result<(TcpStream, SocketAddr)> { | |
: loop { | |
: if let Some(mut pending) = self.pending_accept.take() { | |
: match pending.poll().expect("shouldn't be canceled") { | |
: Async::NotReady => { | |
: self.pending_accept = Some(pending); | |
: return Err(mio::would_block()) | |
: }, | |
: Async::Ready(r) => return r, | |
: } | |
: } | |
: | |
: if let Async::NotReady = self.io.poll_read() { | |
: return Err(io::Error::new(io::ErrorKind::WouldBlock, "not ready")) | |
: } | |
: | |
: match self.io.get_ref().accept() { | |
: Err(e) => { | |
: if e.kind() == io::ErrorKind::WouldBlock { | |
: self.io.need_read(); | |
: } | |
: return Err(e) | |
: }, | |
: Ok((sock, addr)) => { | |
: // Fast path if we haven't left the event loop | |
: if let Some(handle) = self.io.remote().handle() { | |
: let io = try!(PollEvented::new(sock, &handle)); | |
: return Ok((TcpStream { io: io }, addr)) | |
: } | |
: | |
: // If we're off the event loop then send the socket back | |
: // over there to get registered and then we'll get it back | |
: // eventually. | |
: let (tx, rx) = oneshot::channel(); | |
: let remote = self.io.remote().clone(); | |
: remote.spawn(move |handle| { | |
: let res = PollEvented::new(sock, handle) | |
: .map(move |io| { | |
: (TcpStream { io: io }, addr) | |
: }); | |
: tx.complete(res); | |
: Ok(()) | |
: }); | |
: self.pending_accept = Some(rx); | |
: // continue to polling the `rx` at the beginning of the loop | |
: } | |
: } | |
: } | |
: } | |
: | |
: /// Create a new TCP listener from the standard library's TCP listener. | |
: /// | |
: /// This method can be used when the `Handle::tcp_listen` method isn't | |
: /// sufficient because perhaps some more configuration is needed in terms of | |
: /// before the calls to `bind` and `listen`. | |
: /// | |
: /// This API is typically paired with the `net2` crate and the `TcpBuilder` | |
: /// type to build up and customize a listener before it's shipped off to the | |
: /// backing event loop. This allows configuration of options like | |
: /// `SO_REUSEPORT`, binding to multiple addresses, etc. | |
: /// | |
: /// The `addr` argument here is one of the addresses that `listener` is | |
: /// bound to and the listener will only be guaranteed to accept connections | |
: /// of the same address type currently. | |
: /// | |
: /// Finally, the `handle` argument is the event loop that this listener will | |
: /// be bound to. | |
: /// | |
: /// The platform specific behavior of this function looks like: | |
: /// | |
: /// * On Unix, the socket is placed into nonblocking mode and connections | |
: /// can be accepted as normal | |
: /// | |
: /// * On Windows, the address is stored internally and all future accepts | |
: /// will only be for the same IP version as `addr` specified. That is, if | |
: /// `addr` is an IPv4 address then all sockets accepted will be IPv4 as | |
: /// well (same for IPv6). | |
: pub fn from_listener(listener: net::TcpListener, | |
: addr: &SocketAddr, | |
: handle: &Handle) -> io::Result<TcpListener> { | |
: let l = try!(mio::tcp::TcpListener::from_listener(listener, addr)); | |
: TcpListener::new(l, handle) | |
: } | |
: | |
: fn new(listener: mio::tcp::TcpListener, handle: &Handle) | |
: -> io::Result<TcpListener> { | |
: let io = try!(PollEvented::new(listener, handle)); | |
: Ok(TcpListener { io: io, pending_accept: None }) | |
: } | |
: | |
: /// Test whether this socket is ready to be read or not. | |
: pub fn poll_read(&self) -> Async<()> { | |
: self.io.poll_read() | |
: } | |
: | |
: /// Returns the local address that this listener is bound to. | |
: /// | |
: /// This can be useful, for example, when binding to port 0 to figure out | |
: /// which port was actually bound. | |
: pub fn local_addr(&self) -> io::Result<SocketAddr> { | |
: self.io.get_ref().local_addr() | |
: } | |
: | |
: /// Consumes this listener, returning a stream of the sockets this listener | |
: /// accepts. | |
: /// | |
: /// This method returns an implementation of the `Stream` trait which | |
: /// resolves to the sockets the are accepted on this listener. | |
: pub fn incoming(self) -> Incoming { | |
: Incoming { inner: self } | |
: } | |
: | |
: /// Sets the value for the `IP_TTL` option on this socket. | |
: /// | |
: /// This value sets the time-to-live field that is used in every packet sent | |
: /// from this socket. | |
: pub fn set_ttl(&self, ttl: u32) -> io::Result<()> { | |
: self.io.get_ref().set_ttl(ttl) | |
: } | |
: | |
: /// Gets the value of the `IP_TTL` option for this socket. | |
: /// | |
: /// For more information about this option, see [`set_ttl`][link]. | |
: /// | |
: /// [link]: #method.set_ttl | |
: pub fn ttl(&self) -> io::Result<u32> { | |
: self.io.get_ref().ttl() | |
: } | |
: | |
: /// Sets the value for the `IPV6_V6ONLY` option on this socket. | |
: /// | |
: /// If this is set to `true` then the socket is restricted to sending and | |
: /// receiving IPv6 packets only. In this case two IPv4 and IPv6 applications | |
: /// can bind the same port at the same time. | |
: /// | |
: /// If this is set to `false` then the socket can be used to send and | |
: /// receive packets from an IPv4-mapped IPv6 address. | |
: pub fn set_only_v6(&self, only_v6: bool) -> io::Result<()> { | |
: self.io.get_ref().set_only_v6(only_v6) | |
: } | |
: | |
: /// Gets the value of the `IPV6_V6ONLY` option for this socket. | |
: /// | |
: /// For more information about this option, see [`set_only_v6`][link]. | |
: /// | |
: /// [link]: #method.set_only_v6 | |
: pub fn only_v6(&self) -> io::Result<bool> { | |
: self.io.get_ref().only_v6() | |
: } | |
:} | |
: | |
:impl fmt::Debug for TcpListener { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: self.io.get_ref().fmt(f) | |
: } | |
:} | |
: | |
:impl Stream for Incoming { | |
: type Item = (TcpStream, SocketAddr); | |
: type Error = io::Error; | |
: | |
: fn poll(&mut self) -> Poll<Option<Self::Item>, io::Error> { | |
: Ok(Async::Ready(Some(try_nb!(self.inner.accept())))) | |
: } | |
:} | |
: | |
:/// An I/O object representing a TCP stream connected to a remote endpoint. | |
:/// | |
:/// A TCP stream can either be created by connecting to an endpoint or by | |
:/// accepting a connection from a listener. Inside the stream is access to the | |
:/// raw underlying I/O object as well as streams for the read/write | |
:/// notifications on the stream itself. | |
:pub struct TcpStream { | |
: io: PollEvented<mio::tcp::TcpStream>, | |
:} | |
: | |
:/// Future returned by `TcpStream::connect` which will resolve to a `TcpStream` | |
:/// when the stream is connected. | |
:pub struct TcpStreamNew { | |
: inner: TcpStreamNewState, | |
:} | |
: | |
:enum TcpStreamNewState { | |
: Waiting(TcpStream), | |
: Error(io::Error), | |
: Empty, | |
:} | |
: | |
:impl TcpStream { | |
: /// Create a new TCP stream connected to the specified address. | |
: /// | |
: /// This function will create a new TCP socket and attempt to connect it to | |
: /// the `addr` provided. The returned future will be resolved once the | |
: /// stream has successfully connected. If an error happens during the | |
: /// connection or during the socket creation, that error will be returned to | |
: /// the future instead. | |
: pub fn connect(addr: &SocketAddr, handle: &Handle) -> TcpStreamNew { | |
: let inner = match mio::tcp::TcpStream::connect(addr) { | |
: Ok(tcp) => TcpStream::new(tcp, handle), | |
: Err(e) => TcpStreamNewState::Error(e), | |
: }; | |
: TcpStreamNew { inner: inner } | |
: } | |
: | |
: fn new(connected_stream: mio::tcp::TcpStream, handle: &Handle) | |
: -> TcpStreamNewState { | |
: match PollEvented::new(connected_stream, handle) { | |
: Ok(io) => TcpStreamNewState::Waiting(TcpStream { io: io }), | |
: Err(e) => TcpStreamNewState::Error(e), | |
: } | |
: } | |
: | |
: /// Creates a new `TcpStream` from the pending socket inside the given | |
: /// `std::net::TcpStream`, connecting it to the address specified. | |
: /// | |
: /// This constructor allows configuring the socket before it's actually | |
: /// connected, and this function will transfer ownership to the returned | |
: /// `TcpStream` if successful. An unconnected `TcpStream` can be created | |
: /// with the `net2::TcpBuilder` type (and also configured via that route). | |
: /// | |
: /// The platform specific behavior of this function looks like: | |
: /// | |
: /// * On Unix, the socket is placed into nonblocking mode and then a | |
: /// `connect` call is issued. | |
: /// | |
: /// * On Windows, the address is stored internally and the connect operation | |
: /// is issued when the returned `TcpStream` is registered with an event | |
: /// loop. Note that on Windows you must `bind` a socket before it can be | |
: /// connected, so if a custom `TcpBuilder` is used it should be bound | |
: /// (perhaps to `INADDR_ANY`) before this method is called. | |
: pub fn connect_stream(stream: net::TcpStream, | |
: addr: &SocketAddr, | |
: handle: &Handle) -> IoFuture<TcpStream> { | |
: let state = match mio::tcp::TcpStream::connect_stream(stream, addr) { | |
: Ok(tcp) => TcpStream::new(tcp, handle), | |
: Err(e) => TcpStreamNewState::Error(e), | |
: }; | |
: state.boxed() | |
: } | |
: | |
: /// Test whether this socket is ready to be read or not. | |
: /// | |
: /// If the socket is *not* readable then the current task is scheduled to | |
: /// get a notification when the socket does become readable. That is, this | |
: /// is only suitable for calling in a `Future::poll` method and will | |
: /// automatically handle ensuring a retry once the socket is readable again. | |
: pub fn poll_read(&self) -> Async<()> { | |
: self.io.poll_read() | |
: } | |
: | |
: /// Test whether this socket is ready to be written to or not. | |
: /// | |
: /// If the socket is *not* writable then the current task is scheduled to | |
: /// get a notification when the socket does become writable. That is, this | |
: /// is only suitable for calling in a `Future::poll` method and will | |
: /// automatically handle ensuring a retry once the socket is writable again. | |
: pub fn poll_write(&self) -> Async<()> { | |
: self.io.poll_write() | |
: } | |
: | |
: /// Returns the local address that this stream is bound to. | |
: pub fn local_addr(&self) -> io::Result<SocketAddr> { | |
: self.io.get_ref().local_addr() | |
: } | |
: | |
: /// Returns the remote address that this stream is connected to. | |
: pub fn peer_addr(&self) -> io::Result<SocketAddr> { | |
: self.io.get_ref().peer_addr() | |
: } | |
: | |
: /// Shuts down the read, write, or both halves of this connection. | |
: /// | |
: /// This function will cause all pending and future I/O on the specified | |
: /// portions to return immediately with an appropriate value (see the | |
: /// documentation of `Shutdown`). | |
: pub fn shutdown(&self, how: Shutdown) -> io::Result<()> { | |
: self.io.get_ref().shutdown(how) | |
: } | |
: | |
: /// Sets the value of the `TCP_NODELAY` option on this socket. | |
: /// | |
: /// If set, this option disables the Nagle algorithm. This means that | |
: /// segments are always sent as soon as possible, even if there is only a | |
: /// small amount of data. When not set, data is buffered until there is a | |
: /// sufficient amount to send out, thereby avoiding the frequent sending of | |
: /// small packets. | |
: pub fn set_nodelay(&self, nodelay: bool) -> io::Result<()> { | |
: self.io.get_ref().set_nodelay(nodelay) | |
: } | |
: | |
: /// Gets the value of the `TCP_NODELAY` option on this socket. | |
: /// | |
: /// For more information about this option, see [`set_nodelay`][link]. | |
: /// | |
: /// [link]: #method.set_nodelay | |
: pub fn nodelay(&self) -> io::Result<bool> { | |
: self.io.get_ref().nodelay() | |
: } | |
: | |
: /// Sets whether keepalive messages are enabled to be sent on this socket. | |
: /// | |
: /// On Unix, this option will set the `SO_KEEPALIVE` as well as the | |
: /// `TCP_KEEPALIVE` or `TCP_KEEPIDLE` option (depending on your platform). | |
: /// On Windows, this will set the `SIO_KEEPALIVE_VALS` option. | |
: /// | |
: /// If `None` is specified then keepalive messages are disabled, otherwise | |
: /// the number of milliseconds specified will be the time to remain idle | |
: /// before sending a TCP keepalive probe. | |
: /// | |
: /// Some platforms specify this value in seconds, so sub-second millisecond | |
: /// specifications may be omitted. | |
: pub fn set_keepalive_ms(&self, keepalive: Option<u32>) -> io::Result<()> { | |
: self.io.get_ref().set_keepalive_ms(keepalive) | |
: } | |
: | |
: /// Returns whether keepalive messages are enabled on this socket, and if so | |
: /// the amount of milliseconds between them. | |
: /// | |
: /// For more information about this option, see [`set_keepalive_ms`][link]. | |
: /// | |
: /// [link]: #method.set_keepalive_ms | |
: pub fn keepalive_ms(&self) -> io::Result<Option<u32>> { | |
: self.io.get_ref().keepalive_ms() | |
: } | |
: | |
: /// Sets the value for the `IP_TTL` option on this socket. | |
: /// | |
: /// This value sets the time-to-live field that is used in every packet sent | |
: /// from this socket. | |
: pub fn set_ttl(&self, ttl: u32) -> io::Result<()> { | |
: self.io.get_ref().set_ttl(ttl) | |
: } | |
: | |
: /// Gets the value of the `IP_TTL` option for this socket. | |
: /// | |
: /// For more information about this option, see [`set_ttl`][link]. | |
: /// | |
: /// [link]: #method.set_ttl | |
: pub fn ttl(&self) -> io::Result<u32> { | |
: self.io.get_ref().ttl() | |
: } | |
:} | |
: | |
:impl Read for TcpStream { | |
1065 0.0112 : fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { /* _$LT$tokio_core..net..tcp..TcpStream$u20$as$u20$std..io..Read$GT$::read::hb5c2a67f8865558f total: 5404 0.0567 */ | |
: self.io.read(buf) | |
866 0.0091 : } | |
:} | |
: | |
:impl Write for TcpStream { | |
9 9.4e-05 : fn write(&mut self, buf: &[u8]) -> io::Result<usize> { /* _$LT$tokio_core..net..tcp..TcpStream$u20$as$u20$std..io..Write$GT$::write::h1a78a274d7f52ef6 total: 26 2.7e-04 */ | |
: self.io.write(buf) | |
4 4.2e-05 : } | |
: fn flush(&mut self) -> io::Result<()> { | |
: self.io.flush() | |
: } | |
:} | |
: | |
:impl Io for TcpStream { | |
1793 0.0188 : fn poll_read(&mut self) -> Async<()> { /* _$LT$tokio_core..net..tcp..TcpStream$u20$as$u20$tokio_core..io..Io$GT$::poll_read::h7b1dff059370f144 total: 4351 0.0457 */ | |
: <TcpStream>::poll_read(self) | |
215 0.0023 : } | |
: | |
: fn poll_write(&mut self) -> Async<()> { | |
: <TcpStream>::poll_write(self) | |
: } | |
:} | |
: | |
:impl<'a> Read for &'a TcpStream { | |
: fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { | |
: (&self.io).read(buf) | |
: } | |
:} | |
: | |
:impl<'a> Write for &'a TcpStream { | |
: fn write(&mut self, buf: &[u8]) -> io::Result<usize> { | |
: (&self.io).write(buf) | |
: } | |
: | |
: fn flush(&mut self) -> io::Result<()> { | |
: (&self.io).flush() | |
: } | |
:} | |
: | |
:impl<'a> Io for &'a TcpStream { | |
: fn poll_read(&mut self) -> Async<()> { | |
: <TcpStream>::poll_read(self) | |
: } | |
: | |
: fn poll_write(&mut self) -> Async<()> { | |
: <TcpStream>::poll_write(self) | |
: } | |
:} | |
: | |
:impl fmt::Debug for TcpStream { | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: self.io.get_ref().fmt(f) | |
: } | |
:} | |
: | |
:impl Future for TcpStreamNew { | |
: type Item = TcpStream; | |
: type Error = io::Error; | |
: | |
: fn poll(&mut self) -> Poll<TcpStream, io::Error> { | |
: self.inner.poll() | |
: } | |
:} | |
: | |
:impl Future for TcpStreamNewState { | |
: type Item = TcpStream; | |
: type Error = io::Error; | |
: | |
: fn poll(&mut self) -> Poll<TcpStream, io::Error> { | |
: { | |
: let stream = match *self { | |
: TcpStreamNewState::Waiting(ref s) => s, | |
: TcpStreamNewState::Error(_) => { | |
: let e = match mem::replace(self, TcpStreamNewState::Empty) { | |
: TcpStreamNewState::Error(e) => e, | |
: _ => panic!(), | |
: }; | |
: return Err(e) | |
: } | |
: TcpStreamNewState::Empty => panic!("can't poll TCP stream twice"), | |
: }; | |
: | |
: // Once we've connected, wait for the stream to be writable as | |
: // that's when the actual connection has been initiated. Once we're | |
: // writable we check for `take_socket_error` to see if the connect | |
: // actually hit an error or not. | |
: // | |
: // If all that succeeded then we ship everything on up. | |
: if let Async::NotReady = stream.io.poll_write() { | |
: return Ok(Async::NotReady) | |
: } | |
: if let Some(e) = try!(stream.io.get_ref().take_error()) { | |
: return Err(e) | |
: } | |
: } | |
: match mem::replace(self, TcpStreamNewState::Empty) { | |
: TcpStreamNewState::Waiting(stream) => Ok(Async::Ready(stream)), | |
: _ => panic!(), | |
: } | |
: } | |
:} | |
: | |
:#[cfg(unix)] | |
:mod sys { | |
: use std::os::unix::prelude::*; | |
: use super::{TcpStream, TcpListener}; | |
: | |
: impl AsRawFd for TcpStream { | |
: fn as_raw_fd(&self) -> RawFd { | |
: self.io.get_ref().as_raw_fd() | |
: } | |
: } | |
: | |
: impl AsRawFd for TcpListener { | |
: fn as_raw_fd(&self) -> RawFd { | |
: self.io.get_ref().as_raw_fd() | |
: } | |
: } | |
:} | |
: | |
:#[cfg(windows)] | |
:mod sys { | |
: // TODO: let's land these upstream with mio and then we can add them here. | |
: // | |
: // use std::os::windows::prelude::*; | |
: // use super::{TcpStream, TcpListener}; | |
: // | |
: // impl AsRawHandle for TcpStream { | |
: // fn as_raw_handle(&self) -> RawHandle { | |
: // self.io.get_ref().as_raw_handle() | |
: // } | |
: // } | |
: // | |
: // impl AsRawHandle for TcpListener { | |
: // fn as_raw_handle(&self) -> RawHandle { | |
: // self.listener.io().as_raw_handle() | |
: // } | |
: // } | |
:} | |
/* | |
* Total samples for file : "BitcodeWriter.cpp" | |
* | |
* 3892 0.0409 | |
*/ | |
<credited to line zero> 3892 0.0409 : | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeModuleMetadataKinds() total: 5 5.2e-05 */ | |
/* getAttrKindEncoding(llvm::Attribute::AttrKind) total: 1 1.0e-05 */ | |
/* getEncodedCastOpcode(unsigned int) total: 1 1.0e-05 */ | |
/* getEncodedBinaryOpcode(unsigned int) total: 8 8.4e-05 */ | |
/* getEncodedOrdering(llvm::AtomicOrdering) total: 3 3.1e-05 */ | |
/* void llvm::BitstreamWriter::EmitAbbreviatedLiteral<unsigned int>(llvm::BitCodeAbbrevOp const&, unsigned int) [clone .isra.329] total: 11 1.2e-04 */ | |
/* llvm::BitstreamWriter::FlushToWord() [clone .part.310] total: 2 2.1e-05 */ | |
/* llvm::BitstreamWriter::Emit(unsigned int, unsigned int) [clone .constprop.917] total: 2 2.1e-05 */ | |
/* llvm::BitstreamWriter::Emit(unsigned int, unsigned int) [clone .constprop.920] total: 802 0.0084 */ | |
/* llvm::BitstreamWriter::EmitVBR(unsigned int, unsigned int) [clone .constprop.916] total: 943 0.0099 */ | |
/* llvm::BitstreamWriter::Emit(unsigned int, unsigned int) [clone .constprop.921] total: 3 3.1e-05 */ | |
/* llvm::BitstreamWriter::EmitVBR(unsigned int, unsigned int) [clone .constprop.913] total: 4 4.2e-05 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::pushValue(llvm::Value const*, unsigned int, llvm::SmallVectorImpl<unsigned int>&) total: 42 4.4e-04 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::pushValueAndType(llvm::Value const*, unsigned int, llvm::SmallVectorImpl<unsigned int>&) total: 35 3.7e-04 */ | |
/* emitSignedInt64(llvm::SmallVectorImpl<unsigned long>&, unsigned long) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeStringRecord(unsigned int, llvm::StringRef, unsigned int) total: 9 9.4e-05 */ | |
/* void llvm::BitstreamWriter::EmitRecord<llvm::SmallVector<unsigned long, 64u> >(unsigned int, llvm::SmallVector<unsigned long, 64u> const&, unsigned int) [clone .constprop.876] total: 2 2.1e-05 */ | |
/* void llvm::BitstreamWriter::EmitRecord<llvm::SmallVectorImpl<unsigned long> >(unsigned int, llvm::SmallVectorImpl<unsigned long> const&, unsigned int) [clone .constprop.907] total: 117 0.0012 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeMetadataStrings(llvm::ArrayRef<llvm::Metadata const*>, llvm::SmallVectorImpl<unsigned long>&) total: 26 2.7e-04 */ | |
/* getOptimizationFlags(llvm::Value const*) total: 8 8.4e-05 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeInstruction(llvm::Instruction const&, unsigned int, llvm::SmallVectorImpl<unsigned int>&) total: 341 0.0036 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeMetadataRecords(llvm::ArrayRef<llvm::Metadata const*>, llvm::SmallVectorImpl<unsigned long>&) total: 288 0.0030 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeBlockInfo() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeAttributeGroupTable() total: 9 9.4e-05 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeTypeTable() total: 17 1.8e-04 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeModuleInfo() total: 22 2.3e-04 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeConstants(unsigned int, unsigned int, bool) [clone .part.862] total: 77 8.1e-04 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeFunction(llvm::Function const&, llvm::DenseMap<llvm::Function const*, unsigned long, llvm::DenseMapInfo<llvm::Function const*>, llvm::detail::DenseMapPair<llvm::Function const*, unsigned long> >&) total: 1030 0.0108 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeValueSymbolTable(llvm::ValueSymbolTable const&, bool, llvm::DenseMap<llvm::Function const*, unsigned long, llvm::DenseMapInfo<llvm::Function const*>, llvm::detail::DenseMapPair<llvm::Function const*, unsigned long> >*) total: 69 7.2e-04 */ | |
/* (anonymous namespace)::ModuleBitcodeWriter::writeModule() total: 12 1.3e-04 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/slab-0.3.0/src/lib.rs" | |
* | |
* 3707 0.0389 | |
*/ | |
:use std::{fmt, mem, usize}; | |
:use std::iter::IntoIterator; | |
:use std::ops; | |
:use std::marker::PhantomData; | |
: | |
:/// A preallocated chunk of memory for storing objects of the same type. | |
:pub struct Slab<T, I = usize> { | |
: // Chunk of memory | |
: entries: Vec<Slot<T>>, | |
: | |
: // Number of Filled elements currently in the slab | |
: len: usize, | |
: | |
: // Offset of the next available slot in the slab. Set to the slab's | |
: // capacity when the slab is full. | |
: next: usize, | |
: | |
: _marker: PhantomData<I>, | |
:} | |
: | |
:/// A handle to an occupied slot in the `Slab` | |
:pub struct Entry<'a, T: 'a, I: 'a> { | |
: slab: &'a mut Slab<T, I>, | |
: idx: usize, | |
:} | |
: | |
:/// A handle to a vacant slot in the `Slab` | |
:pub struct VacantEntry<'a, T: 'a, I: 'a> { | |
: slab: &'a mut Slab<T, I>, | |
: idx: usize, | |
:} | |
: | |
:/// An iterator over the values stored in the `Slab` | |
:pub struct Iter<'a, T: 'a, I: 'a> { | |
: slab: &'a Slab<T, I>, | |
: cur_idx: usize, | |
: yielded: usize, | |
:} | |
: | |
:/// A mutable iterator over the values stored in the `Slab` | |
:pub struct IterMut<'a, T: 'a, I: 'a> { | |
: slab: *mut Slab<T, I>, | |
: cur_idx: usize, | |
: yielded: usize, | |
: _marker: PhantomData<&'a mut ()>, | |
:} | |
: | |
:enum Slot<T> { | |
: Empty(usize), | |
: Filled(T), | |
: Invalid, | |
:} | |
: | |
:unsafe impl<T, I> Send for Slab<T, I> where T: Send {} | |
: | |
:macro_rules! some { | |
: ($expr:expr) => (match $expr { | |
: Some(val) => val, | |
: None => return None, | |
: }) | |
:} | |
: | |
:impl<T, I> Slab<T, I> { | |
: /// Returns an empty `Slab` with the requested capacity | |
: pub fn with_capacity(capacity: usize) -> Slab<T, I> { | |
: let entries = (1..capacity + 1) | |
: .map(Slot::Empty) | |
: .collect::<Vec<_>>(); | |
: | |
: Slab { | |
: entries: entries, | |
: next: 0, | |
: len: 0, | |
: _marker: PhantomData, | |
: } | |
: } | |
: | |
: /// Returns the number of values stored by the `Slab` | |
: pub fn len(&self) -> usize { | |
: self.len | |
: } | |
: | |
: /// Returns the total capacity of the `Slab` | |
: pub fn capacity(&self) -> usize { | |
: self.entries.len() | |
: } | |
: | |
: /// Returns true if the `Slab` is storing no values | |
: pub fn is_empty(&self) -> bool { | |
: self.len == 0 | |
: } | |
: | |
: /// Returns the number of available slots remaining in the `Slab` | |
: pub fn available(&self) -> usize { | |
: self.entries.len() - self.len | |
: } | |
: | |
: /// Returns true if the `Slab` has available slots | |
: pub fn has_available(&self) -> bool { | |
: self.available() > 0 | |
: } | |
:} | |
: | |
:impl<T, I: Into<usize> + From<usize>> Slab<T, I> { | |
: /// Returns true if the `Slab` contains a value for the given token | |
: pub fn contains(&self, idx: I) -> bool { | |
: self.get(idx).is_some() | |
: } | |
: | |
: /// Get a reference to the value associated with the given token | |
: pub fn get(&self, idx: I) -> Option<&T> { | |
: let idx = some!(self.local_index(idx)); | |
: | |
: match self.entries[idx] { | |
2728 0.0286 : Slot::Filled(ref val) => Some(val), | |
: Slot::Empty(_) => None, | |
: Slot::Invalid => panic!("Slab corrupt"), | |
: } | |
: } | |
: | |
: /// Get a mutable reference to the value associated with the given token | |
: pub fn get_mut(&mut self, idx: I) -> Option<&mut T> { | |
: let idx = some!(self.local_index(idx)); | |
: | |
: match self.entries[idx] { | |
377 0.0040 : Slot::Filled(ref mut v) => Some(v), | |
: _ => None, | |
: } | |
: } | |
: | |
: /// Insert a value into the slab, returning the associated token | |
: pub fn insert(&mut self, val: T) -> Result<I, T> { | |
: match self.vacant_entry() { | |
: Some(entry) => Ok(entry.insert(val).index()), | |
: None => Err(val), | |
: } | |
: } | |
: | |
: /// Returns a handle to an entry. | |
: /// | |
: /// This allows more advanced manipulation of the value stored at the given | |
: /// index. | |
: pub fn entry(&mut self, idx: I) -> Option<Entry<T, I>> { | |
: let idx = some!(self.local_index(idx)); | |
: | |
: match self.entries[idx] { | |
: Slot::Filled(_) => { | |
: Some(Entry { | |
: slab: self, | |
: idx: idx, | |
: }) | |
: } | |
: Slot::Empty(_) => None, | |
: Slot::Invalid => panic!("Slab corrupt"), | |
: } | |
: } | |
: | |
: /// Returns a handle to a vacant entry. | |
: /// | |
: /// This allows optionally inserting a value that is constructed with the | |
: /// index. | |
: pub fn vacant_entry(&mut self) -> Option<VacantEntry<T, I>> { | |
: let idx = self.next; | |
: | |
: if idx >= self.entries.len() { | |
: return None; | |
: } | |
: | |
: Some(VacantEntry { | |
: slab: self, | |
: idx: idx, | |
: }) | |
: } | |
: | |
: /// Releases the given slot | |
: pub fn remove(&mut self, idx: I) -> Option<T> { | |
: self.entry(idx).map(Entry::remove) | |
: } | |
: | |
: /// Retain only the elements specified by the predicate. | |
: /// | |
: /// In other words, remove all elements `e` such that `f(&e)` returns false. | |
: /// This method operates in place and preserves the order of the retained | |
: /// elements. | |
: pub fn retain<F>(&mut self, mut f: F) | |
: where F: FnMut(&T) -> bool | |
: { | |
: for i in 0..self.entries.len() { | |
: if let Some(e) = self.entry(I::from(i)) { | |
: if !f(e.get()) { | |
: e.remove(); | |
: } | |
: } | |
: } | |
: } | |
: | |
: /// An iterator for visiting all elements stored in the `Slab` | |
: pub fn iter(&self) -> Iter<T, I> { | |
: Iter { | |
: slab: self, | |
: cur_idx: 0, | |
: yielded: 0, | |
: } | |
: } | |
: | |
: /// A mutable iterator for visiting all elements stored in the `Slab` | |
: pub fn iter_mut(&mut self) -> IterMut<T, I> { | |
: IterMut { | |
: slab: self as *mut Slab<T, I>, | |
: cur_idx: 0, | |
: yielded: 0, | |
: _marker: PhantomData, | |
: } | |
: } | |
: | |
: /// Empty the slab, by freeing all entries | |
: pub fn clear(&mut self) { | |
: for (i, e) in self.entries.iter_mut().enumerate() { | |
: *e = Slot::Empty(i + 1) | |
: } | |
: self.next = 0; | |
: self.len = 0; | |
: } | |
: | |
: /// Reserves the minimum capacity for exactly `additional` more elements to | |
: /// be inserted in the given `Slab`. Does nothing if the capacity is | |
: /// already sufficient. | |
: pub fn reserve_exact(&mut self, additional: usize) { | |
: let prev_len = self.entries.len(); | |
: | |
: // Ensure `entries_num` isn't too big | |
: assert!(additional < usize::MAX - prev_len, "capacity too large"); | |
: | |
: let prev_len_next = prev_len + 1; | |
: self.entries.extend((prev_len_next..(prev_len_next + additional)).map(Slot::Empty)); | |
: | |
: debug_assert_eq!(self.entries.len(), prev_len + additional); | |
: } | |
: | |
: fn insert_at(&mut self, idx: usize, value: T) -> I { | |
: self.next = match self.entries[idx] { | |
: Slot::Empty(next) => next, | |
: Slot::Filled(_) => panic!("Index already contains value"), | |
: Slot::Invalid => panic!("Slab corrupt"), | |
: }; | |
: | |
: self.entries[idx] = Slot::Filled(value); | |
: self.len += 1; | |
: | |
: I::from(idx) | |
: } | |
: | |
: fn replace(&mut self, idx: usize, e: Slot<T>) -> Option<T> { | |
: if let Slot::Filled(val) = mem::replace(&mut self.entries[idx], e) { | |
: self.next = idx; | |
: return Some(val); | |
: } | |
: | |
: None | |
: } | |
: | |
: fn local_index(&self, idx: I) -> Option<usize> { | |
: let idx: usize = idx.into(); | |
: | |
602 0.0063 : if idx >= self.entries.len() { | |
: return None; | |
: } | |
: | |
: Some(idx) | |
: } | |
:} | |
: | |
:impl<T, I: From<usize> + Into<usize>> ops::Index<I> for Slab<T, I> { | |
: type Output = T; | |
: | |
: fn index(&self, index: I) -> &T { | |
: self.get(index).expect("invalid index") | |
: } | |
:} | |
: | |
:impl<T, I: From<usize> + Into<usize>> ops::IndexMut<I> for Slab<T, I> { | |
: fn index_mut(&mut self, index: I) -> &mut T { | |
: self.get_mut(index).expect("invalid index") | |
: } | |
:} | |
: | |
:impl<T, I> fmt::Debug for Slab<T, I> | |
: where T: fmt::Debug, | |
: I: fmt::Debug, | |
:{ | |
: fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | |
: write!(fmt, | |
: "Slab {{ len: {}, cap: {} }}", | |
: self.len, | |
: self.capacity()) | |
: } | |
:} | |
: | |
:impl<'a, T, I: From<usize> + Into<usize>> IntoIterator for &'a Slab<T, I> { | |
: type Item = &'a T; | |
: type IntoIter = Iter<'a, T, I>; | |
: | |
: fn into_iter(self) -> Iter<'a, T, I> { | |
: self.iter() | |
: } | |
:} | |
: | |
:impl<'a, T, I: From<usize> + Into<usize>> IntoIterator for &'a mut Slab<T, I> { | |
: type Item = &'a mut T; | |
: type IntoIter = IterMut<'a, T, I>; | |
: | |
: fn into_iter(self) -> IterMut<'a, T, I> { | |
: self.iter_mut() | |
: } | |
:} | |
: | |
:/* | |
: * | |
: * ===== Entry ===== | |
: * | |
: */ | |
: | |
:impl<'a, T, I: From<usize> + Into<usize>> Entry<'a, T, I> { | |
: | |
: /// Replace the value stored in the entry | |
: pub fn replace(&mut self, val: T) -> T { | |
: match mem::replace(&mut self.slab.entries[self.idx], Slot::Filled(val)) { | |
: Slot::Filled(v) => v, | |
: _ => panic!("Slab corrupt"), | |
: } | |
: } | |
: | |
: /// Apply the function to the current value, replacing it with the result | |
: /// of the function. | |
: pub fn replace_with<F>(&mut self, f: F) | |
: where F: FnOnce(T) -> T | |
: { | |
: let idx = self.idx; | |
: | |
: // Take the value out of the entry, temporarily setting it to Invalid | |
: let val = match mem::replace(&mut self.slab.entries[idx], Slot::Invalid) { | |
: Slot::Filled(v) => f(v), | |
: _ => panic!("Slab corrupt"), | |
: }; | |
: | |
: self.slab.entries[idx] = Slot::Filled(val); | |
: } | |
: | |
: /// Remove and return the value stored in the entry | |
: pub fn remove(self) -> T { | |
: let next = self.slab.next; | |
: | |
: if let Some(v) = self.slab.replace(self.idx, Slot::Empty(next)) { | |
: self.slab.len -= 1; | |
: v | |
: } else { | |
: panic!("Slab corrupt"); | |
: } | |
: } | |
: | |
: /// Get a reference to the value stored in the entry | |
: pub fn get(&self) -> &T { | |
: let idx = self.index(); | |
: self.slab | |
: .get(idx) | |
: .expect("Filled slot in Entry") | |
: } | |
: | |
: /// Get a mutable reference to the value stored in the entry | |
: pub fn get_mut(&mut self) -> &mut T { | |
: let idx = self.index(); | |
: self.slab | |
: .get_mut(idx) | |
: .expect("Filled slot in Entry") | |
: } | |
: | |
: /// Convert the entry handle to a mutable reference | |
: pub fn into_mut(self) -> &'a mut T { | |
: let idx = self.index(); | |
: self.slab | |
: .get_mut(idx) | |
: .expect("Filled slot in Entry") | |
: } | |
: | |
: /// Return the entry index | |
: pub fn index(&self) -> I { | |
: I::from(self.idx) | |
: } | |
:} | |
: | |
:/* | |
: * | |
: * ===== VacantEntry ===== | |
: * | |
: */ | |
: | |
:impl<'a, T, I: From<usize> + Into<usize>> VacantEntry<'a, T, I> { | |
: /// Insert a value into the entry | |
: pub fn insert(self, val: T) -> Entry<'a, T, I> { | |
: self.slab.insert_at(self.idx, val); | |
: | |
: Entry { | |
: slab: self.slab, | |
: idx: self.idx, | |
: } | |
: } | |
: | |
: /// Returns the entry index | |
: pub fn index(&self) -> I { | |
: I::from(self.idx) | |
: } | |
:} | |
: | |
:/* | |
: * | |
: * ===== Iter ===== | |
: * | |
: */ | |
: | |
:impl<'a, T, I> Iterator for Iter<'a, T, I> { | |
: type Item = &'a T; | |
: | |
: fn next(&mut self) -> Option<&'a T> { | |
: while self.yielded < self.slab.len { | |
: match self.slab.entries[self.cur_idx] { | |
: Slot::Filled(ref v) => { | |
: self.cur_idx += 1; | |
: self.yielded += 1; | |
: return Some(v); | |
: } | |
: Slot::Empty(_) => { | |
: self.cur_idx += 1; | |
: } | |
: Slot::Invalid => { | |
: panic!("Slab corrupt"); | |
: } | |
: } | |
: } | |
: | |
: None | |
: } | |
:} | |
: | |
:/* | |
: * | |
: * ===== IterMut ===== | |
: * | |
: */ | |
: | |
:impl<'a, T, I> Iterator for IterMut<'a, T, I> { | |
: type Item = &'a mut T; | |
: | |
: fn next(&mut self) -> Option<&'a mut T> { | |
: unsafe { | |
: while self.yielded < (*self.slab).len { | |
: let idx = self.cur_idx; | |
: | |
: match (*self.slab).entries[idx] { | |
: Slot::Filled(ref mut v) => { | |
: self.cur_idx += 1; | |
: self.yielded += 1; | |
: return Some(v); | |
: } | |
: Slot::Empty(_) => { | |
: self.cur_idx += 1; | |
: } | |
: Slot::Invalid => { | |
: panic!("Slab corrupt"); | |
: } | |
: } | |
: } | |
: | |
: None | |
: } | |
: } | |
:} | |
: | |
:#[cfg(test)] | |
:mod tests { | |
: use super::*; | |
: | |
: #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | |
: pub struct MyIndex(pub usize); | |
: | |
: impl From<usize> for MyIndex { | |
: fn from(i: usize) -> MyIndex { | |
: MyIndex(i) | |
: } | |
: } | |
: | |
: impl Into<usize> for MyIndex { | |
: fn into(self) -> usize { | |
: self.0 | |
: } | |
: } | |
: | |
: #[test] | |
: fn test_index_trait() { | |
: let mut slab = Slab::<usize, MyIndex>::with_capacity(1); | |
: let idx = slab.insert(10).ok().expect("Failed to insert"); | |
: assert_eq!(idx, MyIndex(0)); | |
: assert_eq!(slab[idx], 10); | |
: } | |
: | |
: #[test] | |
: fn test_insertion() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(1); | |
: assert_eq!(slab.is_empty(), true); | |
: assert_eq!(slab.has_available(), true); | |
: assert_eq!(slab.available(), 1); | |
: let idx = slab.insert(10).ok().expect("Failed to insert"); | |
: assert_eq!(slab[idx], 10); | |
: assert_eq!(slab.is_empty(), false); | |
: assert_eq!(slab.has_available(), false); | |
: assert_eq!(slab.available(), 0); | |
: } | |
: | |
: #[test] | |
: fn test_insert_with() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(1); | |
: | |
: { | |
: let e = slab.vacant_entry().unwrap(); | |
: assert_eq!(e.index(), 0); | |
: let e = e.insert(5); | |
: assert_eq!(5, *e.get()); | |
: } | |
: | |
: assert_eq!(Some(&5), slab.get(0)); | |
: } | |
: | |
: #[test] | |
: fn test_repeated_insertion() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(10); | |
: | |
: for i in 0..10 { | |
: let idx = slab.insert(i + 10).ok().expect("Failed to insert"); | |
: assert_eq!(slab[idx], i + 10); | |
: } | |
: | |
: slab.insert(20).err().expect("Inserted when full"); | |
: } | |
: | |
: #[test] | |
: fn test_repeated_insertion_and_removal() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(10); | |
: let mut indices = vec![]; | |
: | |
: for i in 0..10 { | |
: let idx = slab.insert(i + 10).ok().expect("Failed to insert"); | |
: indices.push(idx); | |
: assert_eq!(slab[idx], i + 10); | |
: } | |
: | |
: for &i in indices.iter() { | |
: slab.remove(i); | |
: } | |
: | |
: slab.insert(20).ok().expect("Failed to insert in newly empty slab"); | |
: } | |
: | |
: #[test] | |
: fn test_insertion_when_full() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(1); | |
: slab.insert(10).ok().expect("Failed to insert"); | |
: slab.insert(10).err().expect("Inserted into a full slab"); | |
: } | |
: | |
: #[test] | |
: fn test_removal_at_boundries() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(1); | |
: assert_eq!(slab.remove(0), None); | |
: assert_eq!(slab.remove(1), None); | |
: } | |
: | |
: #[test] | |
: fn test_removal_is_successful() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(1); | |
: let t1 = slab.insert(10).ok().expect("Failed to insert"); | |
: slab.remove(t1); | |
: let t2 = slab.insert(20).ok().expect("Failed to insert"); | |
: assert_eq!(slab[t2], 20); | |
: } | |
: | |
: #[test] | |
: fn test_remove_empty_entry() { | |
: let mut s = Slab::<(), usize>::with_capacity(3); | |
: let t1 = s.insert(()).unwrap(); | |
: assert!(s.remove(t1).is_some()); | |
: assert!(s.remove(t1).is_none()); | |
: assert!(s.insert(()).is_ok()); | |
: assert!(s.insert(()).is_ok()); | |
: } | |
: | |
: #[test] | |
: fn test_mut_retrieval() { | |
: let mut slab = Slab::<_, usize>::with_capacity(1); | |
: let t1 = slab.insert("foo".to_string()).ok().expect("Failed to insert"); | |
: | |
: slab[t1].push_str("bar"); | |
: | |
: assert_eq!(&slab[t1][..], "foobar"); | |
: } | |
: | |
: #[test] | |
: #[should_panic] | |
: fn test_reusing_slots_1() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(16); | |
: | |
: let t0 = slab.insert(123).unwrap(); | |
: let t1 = slab.insert(456).unwrap(); | |
: | |
: assert!(slab.len() == 2); | |
: assert!(slab.available() == 14); | |
: | |
: slab.remove(t0); | |
: | |
: assert!(slab.len() == 1, "actual={}", slab.len()); | |
: assert!(slab.available() == 15); | |
: | |
: slab.remove(t1); | |
: | |
: assert!(slab.len() == 0); | |
: assert!(slab.available() == 16); | |
: | |
: let _ = slab[t1]; | |
: } | |
: | |
: #[test] | |
: fn test_reusing_slots_2() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(16); | |
: | |
: let t0 = slab.insert(123).unwrap(); | |
: | |
: assert!(slab[t0] == 123); | |
: assert!(slab.remove(t0) == Some(123)); | |
: | |
: let t0 = slab.insert(456).unwrap(); | |
: | |
: assert!(slab[t0] == 456); | |
: | |
: let t1 = slab.insert(789).unwrap(); | |
: | |
: assert!(slab[t0] == 456); | |
: assert!(slab[t1] == 789); | |
: | |
: assert!(slab.remove(t0).unwrap() == 456); | |
: assert!(slab.remove(t1).unwrap() == 789); | |
: | |
: assert!(slab.len() == 0); | |
: } | |
: | |
: #[test] | |
: #[should_panic] | |
: fn test_accessing_out_of_bounds() { | |
: let slab = Slab::<usize, usize>::with_capacity(16); | |
: slab[0]; | |
: } | |
: | |
: #[test] | |
: #[should_panic] | |
: fn test_capacity_too_large1() { | |
: use std::usize; | |
: Slab::<usize, usize>::with_capacity(usize::MAX); | |
: } | |
: | |
: #[test] | |
: #[should_panic] | |
: fn test_capacity_too_large_in_reserve_exact() { | |
: use std::usize; | |
: let mut slab = Slab::<usize, usize>::with_capacity(100); | |
: slab.reserve_exact(usize::MAX - 100); | |
: } | |
: | |
: #[test] | |
: fn test_contains() { | |
: let mut slab = Slab::with_capacity(16); | |
: assert!(!slab.contains(0)); | |
: | |
: let idx = slab.insert(111).unwrap(); | |
: assert!(slab.contains(idx)); | |
: } | |
: | |
: #[test] | |
: fn test_get() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(16); | |
: let tok = slab.insert(5).unwrap(); | |
: assert_eq!(slab.get(tok), Some(&5)); | |
: assert_eq!(slab.get(1), None); | |
: assert_eq!(slab.get(23), None); | |
: } | |
: | |
: #[test] | |
: fn test_get_mut() { | |
: let mut slab = Slab::<u32, usize>::with_capacity(16); | |
: let tok = slab.insert(5u32).unwrap(); | |
: { | |
: let mut_ref = slab.get_mut(tok).unwrap(); | |
: assert_eq!(*mut_ref, 5); | |
: *mut_ref = 12; | |
: } | |
: assert_eq!(slab[tok], 12); | |
: assert_eq!(slab.get_mut(1), None); | |
: assert_eq!(slab.get_mut(23), None); | |
: } | |
: | |
: #[test] | |
: fn test_replace() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(16); | |
: let tok = slab.insert(5).unwrap(); | |
: | |
: slab.entry(tok).unwrap().replace(6); | |
: assert!(slab.entry(tok + 1).is_none()); | |
: | |
: assert_eq!(slab[tok], 6); | |
: assert_eq!(slab.len(), 1); | |
: } | |
: | |
: #[test] | |
: fn test_replace_again() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(16); | |
: let tok = slab.insert(5).unwrap(); | |
: | |
: slab.entry(tok).unwrap().replace(6); | |
: slab.entry(tok).unwrap().replace(7); | |
: slab.entry(tok).unwrap().replace(8); | |
: assert_eq!(slab[tok], 8); | |
: } | |
: | |
: #[test] | |
: fn test_replace_with() { | |
: let mut slab = Slab::<u32, usize>::with_capacity(16); | |
: let tok = slab.insert(5u32).unwrap(); | |
: slab.entry(tok).unwrap().replace_with(|x| x + 1); | |
: assert_eq!(slab[tok], 6); | |
: } | |
: | |
: #[test] | |
: fn test_retain() { | |
: let mut slab = Slab::<usize, usize>::with_capacity(2); | |
: let tok1 = slab.insert(0).unwrap(); | |
: let tok2 = slab.insert(1).unwrap(); | |
: slab.retain(|x| x % 2 == 0); | |
: assert_eq!(slab.len(), 1); | |
: assert_eq!(slab[tok1], 0); | |
: assert_eq!(slab.contains(tok2), false); | |
: } | |
: | |
: #[test] | |
: fn test_iter() { | |
: let mut slab = Slab::<u32, usize>::with_capacity(4); | |
: for i in 0..4 { | |
: slab.insert(i).unwrap(); | |
: } | |
: | |
: let vals: Vec<u32> = slab.iter().map(|r| *r).collect(); | |
: assert_eq!(vals, vec![0, 1, 2, 3]); | |
: | |
: slab.remove(1); | |
: | |
: let vals: Vec<u32> = slab.iter().map(|r| *r).collect(); | |
: assert_eq!(vals, vec![0, 2, 3]); | |
: } | |
: | |
: #[test] | |
: fn test_iter_mut() { | |
: let mut slab = Slab::<u32, usize>::with_capacity(4); | |
: for i in 0..4 { | |
: slab.insert(i).unwrap(); | |
: } | |
: for e in slab.iter_mut() { | |
: *e = *e + 1; | |
: } | |
: | |
: let vals: Vec<u32> = slab.iter().map(|r| *r).collect(); | |
: assert_eq!(vals, vec![1, 2, 3, 4]); | |
: | |
: slab.remove(2); | |
: for e in slab.iter_mut() { | |
: *e = *e + 1; | |
: } | |
: | |
: let vals: Vec<u32> = slab.iter().map(|r| *r).collect(); | |
: assert_eq!(vals, vec![2, 3, 5]); | |
: } | |
: | |
: #[test] | |
: fn test_reserve_exact() { | |
: let mut slab = Slab::<u32, usize>::with_capacity(4); | |
: for i in 0..4 { | |
: slab.insert(i).unwrap(); | |
: } | |
: | |
: assert!(slab.insert(0).is_err()); | |
: | |
: slab.reserve_exact(3); | |
: | |
: let vals: Vec<u32> = slab.iter().map(|r| *r).collect(); | |
: assert_eq!(vals, vec![0, 1, 2, 3]); | |
: | |
: for i in 0..3 { | |
: slab.insert(i).unwrap(); | |
: } | |
: assert!(slab.insert(0).is_err()); | |
: | |
: let vals: Vec<u32> = slab.iter().map(|r| *r).collect(); | |
: assert_eq!(vals, vec![0, 1, 2, 3, 0, 1, 2]); | |
: } | |
: | |
: #[test] | |
: fn test_clear() { | |
: let mut slab = Slab::<u32, usize>::with_capacity(4); | |
: for i in 0..4 { | |
: slab.insert(i).unwrap(); | |
: } | |
: | |
: // clear full | |
: slab.clear(); | |
: | |
: let vals: Vec<u32> = slab.iter().map(|r| *r).collect(); | |
: assert_eq!(vals, vec![]); | |
: | |
: for i in 0..2 { | |
: slab.insert(i).unwrap(); | |
: } | |
: | |
: let vals: Vec<u32> = slab.iter().map(|r| *r).collect(); | |
: assert_eq!(vals, vec![0, 1]); | |
: | |
: | |
: // clear half-filled | |
: slab.clear(); | |
: | |
: let vals: Vec<u32> = slab.iter().map(|r| *r).collect(); | |
: assert_eq!(vals, vec![]); | |
: } | |
:} | |
/* | |
* Total samples for file : "ScalarEvolution.cpp" | |
* | |
* 3539 0.0372 | |
*/ | |
<credited to line zero> 3539 0.0372 : | |
/* __gnu_cxx::__exchange_and_add_dispatch(int*, int) [clone .constprop.1287] total: 147 0.0015 */ | |
/* llvm::SCEV const* getExtendAddRecStart<llvm::SCEVSignExtendExpr>(llvm::SCEVAddRecExpr const*, llvm::Type*, llvm::ScalarEvolution*) total: 2 2.1e-05 */ | |
/* llvm::SCEV const* getExtendAddRecStart<llvm::SCEVZeroExtendExpr>(llvm::SCEVAddRecExpr const*, llvm::Type*, llvm::ScalarEvolution*) total: 6 6.3e-05 */ | |
/* llvm::Optional<(anonymous namespace)::BinaryOp>::getPointer() total: 1 1.0e-05 */ | |
/* llvm::Optional<(anonymous namespace)::BinaryOp>::operator*() total: 1 1.0e-05 */ | |
/* llvm::APInt::operator!=(unsigned long) const [clone .constprop.1324] total: 5 5.2e-05 */ | |
/* llvm::SCEVAddRecExpr::getNumIterationsInRange(llvm::ConstantRange const&, llvm::ScalarEvolution&) const::{lambda(llvm::SCEV const*)#1}::operator()(llvm::SCEV const*) const [clone .isra.643] total: 1 1.0e-05 */ | |
/* std::_Rb_tree<llvm::APInt, std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> >, std::_Select1st<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > >, llvm::ScalarEvolution::getAddExpr(llvm::SmallVectorImpl<llvm::SCEV const*>&, llvm::SCEV::NoWrapFlags)::APIntCompare, std::allocator<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > > >::_M_erase(std::_Rb_tree_node<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > >*) total: 15 1.6e-04 */ | |
/* getOtherIncomingValue(llvm::PHINode*, llvm::BasicBlock*) total: 8 8.4e-05 */ | |
/* llvm::ConstantRange::operator==(llvm::ConstantRange const&) const [clone .part.104] total: 2 2.1e-05 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.1328] total: 104 0.0011 */ | |
/* llvm::Optional<(anonymous namespace)::BinaryOp>::reset() total: 10 1.0e-04 */ | |
/* llvm::ScalarEvolution::isKnownPredicateViaConstantRanges(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*)::{lambda(llvm::ConstantRange const&, llvm::ConstantRange const&)#1}::operator()(llvm::ConstantRange const&, llvm::ConstantRange const&) const total: 15 1.6e-04 */ | |
/* bool llvm::all_of<llvm::BasicBlock&, llvm::ScalarEvolution::loopHasNoAbnormalExits(llvm::Loop const*)::{lambda(llvm::BasicBlock*)#1}::operator()(llvm::BasicBlock*) const::{lambda(llvm::Instruction&)#1}>(llvm::BasicBlock&, llvm::ScalarEvolution::loopHasNoAbnormalExits(llvm::Loop const*)::{lambda(llvm::BasicBlock*)#1}::operator()(llvm::BasicBlock*) const::{lambda(llvm::Instruction&)#1}&&) [clone .isra.889] total: 3 3.1e-05 */ | |
/* llvm::BranchInst::getSuccessor(unsigned int) const [clone .constprop.1319] total: 16 1.7e-04 */ | |
/* MatchNotExpr(llvm::SCEV const*) total: 13 1.4e-04 */ | |
/* llvm::ScalarEvolution::ExitLimit::hasAnyInfo() const [clone .part.820] total: 1 1.0e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >, llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*>, llvm::detail::DenseMapPair<llvm::ScalarEvolution::SCEVCallbackVH, llvm::SCEV const*> >::destroyAll() [clone .part.510] total: 24 2.5e-04 */ | |
/* (anonymous namespace)::BinaryOp::BinaryOp(llvm::Operator*) total: 22 2.3e-04 */ | |
/* llvm::ScalarEvolution::checkValidity(llvm::SCEV const*) const::FindInvalidSCEVUnknown::follow(llvm::SCEV const*) total: 142 0.0015 */ | |
/* (anonymous namespace)::SCEVComplexityCompare::compare(llvm::SCEV const*, llvm::SCEV const*) const total: 301 0.0032 */ | |
/* void std::__insertion_sort<llvm::SCEV const**, (anonymous namespace)::SCEVComplexityCompare>(llvm::SCEV const**, llvm::SCEV const**, (anonymous namespace)::SCEVComplexityCompare) total: 46 4.8e-04 */ | |
/* void std::__merge_sort_with_buffer<llvm::SCEV const**, llvm::SCEV const**, (anonymous namespace)::SCEVComplexityCompare>(llvm::SCEV const**, llvm::SCEV const**, llvm::SCEV const**, (anonymous namespace)::SCEVComplexityCompare) total: 77 8.1e-04 */ | |
/* IsAvailableOnEntry(llvm::Loop const*, llvm::DominatorTree&, llvm::SCEV const*, llvm::BasicBlock*)::CheckAvailable::follow(llvm::SCEV const*) total: 8 8.4e-05 */ | |
/* HasSameValue(llvm::SCEV const*, llvm::SCEV const*) total: 52 5.5e-04 */ | |
/* BuildConstantFromSCEV(llvm::SCEV const*) total: 30 3.1e-04 */ | |
/* llvm::SCEVTraversal<llvm::ScalarEvolution::hasOperand(llvm::SCEV const*, llvm::SCEV const*) const::SCEVSearch>::push(llvm::SCEV const*) total: 34 3.6e-04 */ | |
/* llvm::SCEVTraversal<(anonymous namespace)::FindAddRecurrence>::push(llvm::SCEV const*) total: 10 1.0e-04 */ | |
/* llvm::SCEVTraversal<llvm::ScalarEvolution::checkValidity(llvm::SCEV const*) const::FindInvalidSCEVUnknown>::push(llvm::SCEV const*) total: 123 0.0013 */ | |
/* llvm::SCEVTraversal<IsAvailableOnEntry(llvm::Loop const*, llvm::DominatorTree&, llvm::SCEV const*, llvm::BasicBlock*)::CheckAvailable>::push(llvm::SCEV const*) total: 5 5.2e-05 */ | |
/* PushLoopPHIs(llvm::Loop const*, llvm::SmallVectorImpl<llvm::Instruction*>&) total: 13 1.4e-04 */ | |
/* PushDefUseChildren(llvm::Instruction*, llvm::SmallVectorImpl<llvm::Instruction*>&) total: 111 0.0012 */ | |
/* MatchBinaryOp(llvm::Value*, llvm::DominatorTree&) total: 88 9.2e-04 */ | |
/* llvm::ScalarEvolution::forgetLoop(llvm::Loop const*)::{lambda(llvm::DenseMap<llvm::Loop const*, llvm::ScalarEvolution::BackedgeTakenInfo, llvm::DenseMapInfo<llvm::Loop const*>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::ScalarEvolution::BackedgeTakenInfo> >&)#1}::operator()(llvm::DenseMap<llvm::Loop const*, llvm::ScalarEvolution::BackedgeTakenInfo, llvm::DenseMapInfo<llvm::Loop const*>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::ScalarEvolution::BackedgeTakenInfo> >&) const total: 1 1.0e-05 */ | |
/* llvm::ScalarEvolution::computeShiftCompareExitLimit(llvm::Value*, llvm::Value*, llvm::Loop const*, llvm::CmpInst::Predicate)::{lambda(llvm::Value*, llvm::Value*&, llvm::Instruction::BinaryOps&)#1}::operator()(llvm::Value*, llvm::Value*&, llvm::Instruction::BinaryOps&) const [clone .isra.1048] total: 2 2.1e-05 */ | |
/* llvm::ScalarEvolution::getRangeViaFactoring(llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*, unsigned int)::SelectPattern::SelectPattern(llvm::ScalarEvolution&, unsigned int, llvm::SCEV const*) total: 41 4.3e-04 */ | |
/* CanConstantFold(llvm::Instruction const*) total: 29 3.0e-04 */ | |
/* canConstantEvolve(llvm::Instruction*, llvm::Loop const*) total: 7 7.3e-05 */ | |
/* bool IsMaxConsistingOf<llvm::SCEVUMaxExpr>(llvm::SCEV const*, llvm::SCEV const*) total: 4 4.2e-05 */ | |
/* IsAvailableOnEntry(llvm::Loop const*, llvm::DominatorTree&, llvm::SCEV const*, llvm::BasicBlock*) total: 20 2.1e-04 */ | |
/* void llvm::visitAll<llvm::ScalarEvolution::hasOperand(llvm::SCEV const*, llvm::SCEV const*) const::SCEVSearch>(llvm::SCEV const*, llvm::ScalarEvolution::hasOperand(llvm::SCEV const*, llvm::SCEV const*) const::SCEVSearch&) total: 286 0.0030 */ | |
/* llvm::ScalarEvolution::forgetMemoizedResults(llvm::SCEV const*)::{lambda(llvm::DenseMap<llvm::Loop const*, llvm::ScalarEvolution::BackedgeTakenInfo, llvm::DenseMapInfo<llvm::Loop const*>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::ScalarEvolution::BackedgeTakenInfo> >&)#1}::operator()(llvm::DenseMap<llvm::Loop const*, llvm::ScalarEvolution::BackedgeTakenInfo, llvm::DenseMapInfo<llvm::Loop const*>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::ScalarEvolution::BackedgeTakenInfo> >&) const total: 93 9.8e-04 */ | |
/* void std::__merge_adaptive<llvm::SCEV const**, long, llvm::SCEV const**, (anonymous namespace)::SCEVComplexityCompare>(llvm::SCEV const**, llvm::SCEV const**, llvm::SCEV const**, long, long, llvm::SCEV const**, long, (anonymous namespace)::SCEVComplexityCompare) total: 98 0.0010 */ | |
/* void std::__stable_sort_adaptive<llvm::SCEV const**, llvm::SCEV const**, long, (anonymous namespace)::SCEVComplexityCompare>(llvm::SCEV const**, llvm::SCEV const**, llvm::SCEV const**, long, (anonymous namespace)::SCEVComplexityCompare) total: 46 4.8e-04 */ | |
/* GroupByComplexity(llvm::SmallVectorImpl<llvm::SCEV const*>&, llvm::LoopInfo*) total: 239 0.0025 */ | |
/* std::_Rb_tree_iterator<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > > std::_Rb_tree<llvm::APInt, std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> >, std::_Select1st<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > >, llvm::ScalarEvolution::getAddExpr(llvm::SmallVectorImpl<llvm::SCEV const*>&, llvm::SCEV::NoWrapFlags)::APIntCompare, std::allocator<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > > >::_M_insert_<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > >(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> >&&) total: 14 1.5e-04 */ | |
/* std::pair<std::_Rb_tree_iterator<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > >, bool> std::_Rb_tree<llvm::APInt, std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> >, std::_Select1st<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > >, llvm::ScalarEvolution::getAddExpr(llvm::SmallVectorImpl<llvm::SCEV const*>&, llvm::SCEV::NoWrapFlags)::APIntCompare, std::allocator<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > > >::_M_insert_unique<std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> > >(std::pair<llvm::APInt const, llvm::SmallVector<llvm::SCEV const*, 4u> >&&) total: 10 1.0e-04 */ | |
/* getConstantEvolvingPHIOperands(llvm::Instruction*, llvm::Loop const*, llvm::DenseMap<llvm::Instruction*, llvm::PHINode*, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::PHINode*> >&) total: 44 4.6e-04 */ | |
/* getSignedOverflowLimitForStep(llvm::SCEV const*, llvm::CmpInst::Predicate*, llvm::ScalarEvolution*) total: 6 6.3e-05 */ | |
/* StrengthenNoWrapFlags(llvm::ScalarEvolution*, llvm::SCEVTypes, llvm::SmallVectorImpl<llvm::SCEV const*> const&, llvm::SCEV::NoWrapFlags) total: 553 0.0058 */ | |
/* llvm::SCEVVisitor<(anonymous namespace)::SCEVInitRewriter, llvm::SCEV const*>::visit(llvm::SCEV const*) total: 8 8.4e-05 */ | |
/* llvm::ScalarEvolution::getAddExpr(llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV::NoWrapFlags) [clone .constprop.1292] total: 35 3.7e-04 */ | |
/* llvm::ScalarEvolution::SimplifyICmpOperands(llvm::CmpInst::Predicate&, llvm::SCEV const*&, llvm::SCEV const*&, unsigned int) [clone .part.1207] total: 168 0.0018 */ | |
/* llvm::ScalarEvolution::isImpliedCondOperandsHelper(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*)::{lambda(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*)#1}::operator()(llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*) const total: 28 2.9e-04 */ | |
/* CollectAddOperandsWithScales(llvm::DenseMap<llvm::SCEV const*, llvm::APInt, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::APInt> >&, llvm::SmallVectorImpl<llvm::SCEV const*>&, llvm::APInt&, llvm::SCEV const* const*, unsigned long, llvm::APInt const&, llvm::ScalarEvolution&) total: 296 0.0031 */ | |
/* llvm::ScalarEvolution::getMulExpr(llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV::NoWrapFlags) [clone .constprop.1293] total: 56 5.9e-04 */ | |
/* llvm::SCEVRewriteVisitor<(anonymous namespace)::SCEVPredicateRewriter>::visitAddExpr(llvm::SCEVAddExpr const*) total: 1 1.0e-05 */ | |
/* llvm::SCEVVisitor<(anonymous namespace)::SCEVPredicateRewriter, llvm::SCEV const*>::visit(llvm::SCEV const*) total: 3 3.1e-05 */ | |
/* llvm::SCEVRewriteVisitor<(anonymous namespace)::SCEVShiftRewriter>::visitAddExpr(llvm::SCEVAddExpr const*) total: 1 1.0e-05 */ | |
/* llvm::SCEVVisitor<(anonymous namespace)::SCEVShiftRewriter, llvm::SCEV const*>::visit(llvm::SCEV const*) total: 13 1.4e-04 */ | |
/* llvm::SCEVRewriteVisitor<(anonymous namespace)::SCEVShiftRewriter>::visitUDivExpr(llvm::SCEVUDivExpr const*) total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/libcollections/vec_deque.rs" | |
* | |
* 3465 0.0364 | |
*/ | |
/* | |
* Total samples for file : "ConstantFolding.cpp" | |
* | |
* 3419 0.0359 | |
*/ | |
<credited to line zero> 3419 0.0359 : | |
/* (anonymous namespace)::StripPtrCastKeepAS(llvm::Constant*, llvm::Type*&) total: 98 0.0010 */ | |
/* llvm::ConstantExpr::getOperand(unsigned int) const [clone .constprop.241] total: 20 2.1e-04 */ | |
/* (anonymous namespace)::ConstantFoldScalarCall(llvm::StringRef, unsigned int, llvm::Type*, llvm::ArrayRef<llvm::Constant*>, llvm::TargetLibraryInfo const*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::FoldBitCast(llvm::Constant*, llvm::Type*, llvm::DataLayout const&) total: 41 4.3e-04 */ | |
/* (anonymous namespace)::ReadDataFromGlobal(llvm::Constant*, unsigned long, unsigned char*, unsigned int, llvm::DataLayout const&) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::FoldReinterpretLoadFromConstPtr(llvm::Constant*, llvm::Type*, llvm::DataLayout const&) total: 65 6.8e-04 */ | |
/* (anonymous namespace)::SymbolicallyEvaluateGEP(llvm::GEPOperator const*, llvm::ArrayRef<llvm::Constant*>, llvm::DataLayout const&, llvm::TargetLibraryInfo const*) total: 750 0.0079 */ | |
/* (anonymous namespace)::ConstantFoldInstOperandsImpl(llvm::Value const*, llvm::Type*, unsigned int, llvm::ArrayRef<llvm::Constant*>, llvm::DataLayout const&, llvm::TargetLibraryInfo const*) total: 2177 0.0229 */ | |
/* (anonymous namespace)::ConstantFoldConstantExpressionImpl(llvm::ConstantExpr const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*, llvm::SmallPtrSetImpl<llvm::ConstantExpr*>&) total: 265 0.0028 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/string/../sysdeps/x86_64/memchr.S" | |
* | |
* 3396 0.0357 | |
*/ | |
/* memchr total: 3396 0.0357 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/fmt/mod.rs" | |
* | |
* 3363 0.0353 | |
*/ | |
/* _$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::hffa182269dcde3e7 total: 24 2.5e-04 */ | |
/* _$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::hbc85533e9016175c total: 930 0.0098 */ | |
/* _$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h6e8834e7a9e8f5c7 total: 1 1.0e-05 */ | |
/* _$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_char::h97b8de5dac63f7a5 total: 20 2.1e-04 */ | |
/* _$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_char::h67806f9b25ad55f0 total: 1 1.0e-05 */ | |
/* core::fmt::write::h0dfe169107a72abb total: 192 0.0020 */ | |
/* core::fmt::write::h0dfe169107a72abb total: 1164 0.0122 */ | |
/* core::fmt::Formatter::pad_integral::h73236f8594eaf51c total: 48 5.0e-04 */ | |
/* core::fmt::Formatter::pad_integral::h73236f8594eaf51c total: 550 0.0058 */ | |
/* core::fmt::Formatter::pad::h42244cecbbb2faad total: 318 0.0033 */ | |
/* core::fmt::Formatter::write_str::ha71aec2e680ff16f total: 25 2.6e-04 */ | |
/* core::fmt::Formatter::write_fmt::h38e752fbf0609f9d total: 31 3.3e-04 */ | |
/* core::fmt::Formatter::write_fmt::h38e752fbf0609f9d total: 318 0.0033 */ | |
/* _$LT$core..fmt..Formatter$LT$$u27$a$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h7e4225aaf4c5d204 total: 18 1.9e-04 */ | |
/* _$LT$core..fmt..Formatter$LT$$u27$a$GT$$u20$as$u20$core..fmt..Write$GT$::write_char::h687c3250a76c5d1c total: 15 1.6e-04 */ | |
/* _$LT$$RF$$u27$a$u20$T$u20$as$u20$core..fmt..Display$GT$::fmt::h5e730d2b33b67043 total: 26 2.7e-04 */ | |
/* _$LT$str$u20$as$u20$core..fmt..Display$GT$::fmt::hdb4da266c1f0804d total: 290 0.0030 */ | |
/* | |
* Total samples for file : "ScheduleDAGRRList.cpp" | |
* | |
* 3362 0.0353 | |
*/ | |
<credited to line zero> 3362 0.0353 : | |
/* _GLOBAL__sub_I_ScheduleDAGRRList.cpp total: 1 1.0e-05 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::forceUnitLatencies() const total: 54 5.7e-04 */ | |
/* (anonymous namespace)::RegReductionPQBase::releaseState() total: 17 1.8e-04 */ | |
/* (anonymous namespace)::RegReductionPQBase::empty() const total: 72 7.6e-04 */ | |
/* CalcNodeSethiUllmanNumber(llvm::SUnit const*, std::vector<unsigned int, std::allocator<unsigned int> >&) total: 93 9.8e-04 */ | |
/* (anonymous namespace)::RegReductionPQBase::getNodePriority(llvm::SUnit const*) const total: 39 4.1e-04 */ | |
/* BUHasStall(llvm::SUnit*, int, (anonymous namespace)::RegReductionPQBase*) [clone .part.91] total: 7 7.3e-05 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::EmitNode(llvm::SUnit*) [clone .isra.110] total: 45 4.7e-04 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::ReleasePending() [clone .part.301] total: 97 0.0010 */ | |
/* (anonymous namespace)::RegReductionPQBase::~RegReductionPQBase() total: 19 2.0e-04 */ | |
/* hasOnlyLiveOutUses(llvm::SUnit const*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::RegReductionPriorityQueue<(anonymous namespace)::src_ls_rr_sort>::~RegReductionPriorityQueue() total: 5 5.2e-05 */ | |
/* FindCallSeqStart(llvm::SDNode*, unsigned int&, unsigned int&, llvm::TargetInstrInfo const*) total: 64 6.7e-04 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::releaseInterferences(unsigned int) total: 28 2.9e-04 */ | |
/* closestSucc(llvm::SUnit const*) total: 29 3.0e-04 */ | |
/* BUCompareLatency(llvm::SUnit*, llvm::SUnit*, bool, (anonymous namespace)::RegReductionPQBase*) total: 58 6.1e-04 */ | |
/* BURRSort(llvm::SUnit*, llvm::SUnit*, (anonymous namespace)::RegReductionPQBase*) total: 89 9.3e-04 */ | |
/* llvm::SUnit* (anonymous namespace)::popFromQueueImpl<(anonymous namespace)::src_ls_rr_sort>(std::vector<llvm::SUnit*, std::allocator<llvm::SUnit*> >&, (anonymous namespace)::src_ls_rr_sort&) total: 201 0.0021 */ | |
/* (anonymous namespace)::RegReductionPriorityQueue<(anonymous namespace)::src_ls_rr_sort>::pop() total: 81 8.5e-04 */ | |
/* (anonymous namespace)::RegReductionPQBase::scheduledNode(llvm::SUnit*) total: 91 9.6e-04 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::~ScheduleDAGRRList() total: 39 4.1e-04 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::~ScheduleDAGRRList() total: 30 3.1e-04 */ | |
/* (anonymous namespace)::RegReductionPQBase::push(llvm::SUnit*) total: 102 0.0011 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::ScheduleDAGRRList(llvm::MachineFunction&, bool, llvm::SchedulingPriorityQueue*, llvm::CodeGenOpt::Level) total: 119 0.0012 */ | |
/* (anonymous namespace)::RegReductionPQBase::initNodes(std::vector<llvm::SUnit, std::allocator<llvm::SUnit> >&) total: 270 0.0028 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::PickNodeToScheduleBottomUp() total: 517 0.0054 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::ReleasePredecessors(llvm::SUnit*) total: 402 0.0042 */ | |
/* (anonymous namespace)::ScheduleDAGRRList::Schedule() total: 792 0.0083 */ | |
/* | |
* Total samples for file : "CorrelatedValuePropagation.cpp" | |
* | |
* 3236 0.0340 | |
*/ | |
<credited to line zero> 3236 0.0340 : | |
/* (anonymous namespace)::CorrelatedValuePropagation::~CorrelatedValuePropagation() total: 1 1.0e-05 */ | |
/* processSwitch(llvm::SwitchInst*, llvm::LazyValueInfo*) total: 12 1.3e-04 */ | |
/* runImpl(llvm::Function&, llvm::LazyValueInfo*) total: 3150 0.0331 */ | |
/* (anonymous namespace)::CorrelatedValuePropagation::runOnFunction(llvm::Function&) total: 73 7.7e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/time/mod.rs" | |
* | |
* 3167 0.0333 | |
*/ | |
/* std::time::Instant::now::h2ff11c83159cf5b8 total: 5480 0.0575 */ | |
/* std::time::Instant::now::h2ff11c83159cf5b8 total: 119 0.0012 */ | |
/* std::time::Instant::elapsed::he500fa71a0a7df39 total: 90 9.4e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/liballoc/heap.rs" | |
* | |
* 3135 0.0329 | |
*/ | |
/* | |
* Total samples for file : "/checkout/src/libstd/collections/hash/map.rs" | |
* | |
* 3119 0.0327 | |
*/ | |
/* std::collections::hash::map::DefaultResizePolicy::new::hd1086966cfe77902 total: 3113 0.0327 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::reserve::h159e95411cba8fc2 total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::reserve::hf90fdb7a3bb8ce14 total: 9 9.4e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::insert::hce35520c22965c1f total: 3 3.1e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::insert::hd21ef064729d3f1b total: 8 8.4e-05 */ | |
/* _$LT$std..collections..hash..map..DefaultHasher$u20$as$u20$core..hash..Hasher$GT$::write::ha6c366fa6ea72442 total: 4 4.2e-05 */ | |
/* _$LT$std..collections..hash..map..DefaultHasher$u20$as$u20$core..hash..Hasher$GT$::finish::hecd1d036fe9501cb total: 7 7.3e-05 */ | |
/* | |
* Total samples for file : "/home/stb/data-rs/http-server/src/main.rs" | |
* | |
* 3057 0.0321 | |
*/ | |
:#![deny(missing_docs)] | |
:#![deny(warnings)] | |
: | |
://! A simple HTTP server based on a REST API. | |
://! | |
://! You can perform the following actions: | |
://! | |
://! * `GET: /[key]`: returns the value corresponding to [key]. | |
://! * `POST: /[key]`: create a new entry or update it with the given value passed in the body. | |
://! * `DELETE: /[key]`: remove the corresponding [key] from the server. | |
: | |
:extern crate crc; | |
:extern crate futures; | |
:extern crate hyper; | |
:#[cfg(target_os = "linux")] | |
:extern crate libc; | |
:extern crate net2; | |
:extern crate num_cpus; | |
:extern crate reader_writer; | |
:extern crate tokio_core; | |
: | |
:use crc::{crc32, Hasher32}; | |
:use futures::{task, Async, Future, Poll, Stream}; | |
:use futures::future::BoxFuture; | |
:use hyper::{Delete, Get, Put, StatusCode}; | |
:use hyper::header::ContentLength; | |
:use hyper::server::{Http, Service, Request, Response}; | |
:use tokio_core::reactor::Core; | |
:use tokio_core::net::{TcpListener, TcpStream}; | |
: | |
:use std::env; | |
:use std::thread; | |
:use std::path::Path; | |
:use std::net::SocketAddr; | |
:use std::sync::{Arc, Mutex}; | |
:use std::io::{Read, Write}; | |
:use std::fs::File; | |
:use std::os::unix::io::{IntoRawFd, FromRawFd}; | |
: | |
21 2.2e-04 :fn splitter(s: &str) -> Vec<&str> { /* data::splitter::h7c9c5adc3701b0e0 total: 207 0.0022 */ | |
8 8.4e-05 : s.split('/').filter(|x| !x.is_empty()).collect() | |
1 1.0e-05 :} | |
: | |
:/*#[cfg(target_os = "linux")] | |
:unsafe fn stick_this_thread_to_core(core_id: usize) { | |
: let mut cpuset: libc::cpu_set_t = ::std::mem::zeroed(); | |
: libc::CPU_ZERO(&mut cpuset); | |
: libc::CPU_SET(core_id, &mut cpuset); | |
: | |
: let current_thread = libc::pthread_self(); | |
: libc::pthread_setaffinity_np(current_thread, ::std::mem::size_of::<libc::cpu_set_t>(), &cpuset); | |
:}*/ | |
: | |
:#[derive(Clone)] | |
:struct AlphaBravo { | |
: rw: reader_writer::ReaderWriter, | |
:} | |
: | |
:impl AlphaBravo { | |
: pub fn new<P: AsRef<Path>>(path: &P) -> AlphaBravo { | |
: AlphaBravo { | |
: rw: reader_writer::ReaderWriter::new(path).expect("ReaderWriter::new failed"), | |
: } | |
: } | |
:} | |
: | |
:impl Service for AlphaBravo { | |
: type Request = Request; | |
: type Response = Response; | |
: type Error = hyper::Error; | |
: type Future = BoxFuture<Self::Response, Self::Error>; | |
: | |
: fn call(&self, req: Request) -> Self::Future { | |
2 2.1e-05 : let path = req.path().to_owned(); | |
: futures::future::ok(match *req.method() { | |
: Get => { | |
: let values = splitter(&path); | |
: if values.len() < 2 || !self.rw.exists(&values[values.len() - 2]) { | |
: Response::new().with_status(StatusCode::NotFound) | |
: } else if let Some(mut file) = self.rw.get_file(&values[values.len() - 2], false) { | |
: let mut out = Vec::new(); | |
: if file.read_to_end(&mut out).is_ok() { | |
: Response::new().with_body(out) | |
: } else { | |
: Response::new().with_status(StatusCode::InternalServerError) | |
: } | |
: } else { | |
: Response::new().with_status(StatusCode::NotFound) | |
: } | |
: } | |
: Put => { | |
: let values = splitter(&path); | |
3 3.1e-05 : if values.len() < 2 { | |
: Response::new().with_status(StatusCode::NoContent) | |
20 2.1e-04 : } else if let Some(file) = self.rw.get_file(&"null"/*&values[values.len() - 2]*/, true) { | |
: match req.headers().get::<ContentLength>() { | |
1 1.0e-05 : Some(&ContentLength(len)) => { | |
4 4.2e-05 : if len < 1 { | |
: Response::new().with_status(StatusCode::NotModified) | |
: } else { | |
3 3.1e-05 : let raw = file.into_raw_fd(); | |
2 2.1e-05 : let digest = Arc::new(Mutex::new(crc32::Digest::new(crc32::IEEE))); | |
2 2.1e-05 : let digest_clone = digest.clone(); | |
599 0.0063 : return req.body().for_each(move |chunk| { | |
10 1.0e-04 : digest_clone.lock().unwrap().write(&*chunk); | |
892 0.0094 : let mut file = unsafe { File::from_raw_fd(raw) }; | |
426 0.0045 : if file.write(&*chunk).is_ok() { | |
605 0.0064 : file.into_raw_fd(); | |
: Ok(()) | |
: } else { | |
: file.into_raw_fd(); | |
: Err(hyper::Error::Status) | |
: } | |
455 0.0048 : }).then(move |r| { | |
: let _file = unsafe { File::from_raw_fd(raw) }; | |
: let _digest = digest.lock().unwrap().sum32(); | |
: match r { | |
: Ok(_) => { | |
: /*if file.sync_data().is_ok() { | |
: */Ok(Response::new().with_status(StatusCode::Ok)) | |
: /*} else { | |
: Ok(Response::new().with_status(StatusCode::InternalServerError)) | |
: }*/ | |
: } | |
: Err(_) => Ok(Response::new().with_status( | |
: StatusCode::InsufficientStorage)), | |
: } | |
3 3.1e-05 : }).boxed(); | |
: } | |
: } | |
: None => Response::new().with_status(StatusCode::NotModified), | |
: } | |
: } else { | |
: Response::new().with_status(StatusCode::InternalServerError) | |
: } | |
: } | |
: Delete => { | |
: let values = splitter(&path); | |
: if values.len() >= 2 && self.rw.exists(&values[values.len() - 2]) { | |
: match self.rw.remove(&values[values.len() - 2]) { | |
: Ok(_) => Response::new().with_status(StatusCode::Ok), | |
: Err(_) => Response::new().with_status(StatusCode::InternalServerError), | |
: } | |
: } else { | |
: Response::new().with_status(StatusCode::NotFound) | |
: } | |
: } | |
: _ => { | |
: Response::new().with_status(StatusCode::NotFound) | |
: } | |
: }).boxed() | |
: } | |
:} | |
: | |
:struct ThreadData { | |
: entries: Vec<(TcpStream, SocketAddr)>, | |
: task: Option<task::Task>, | |
:} | |
: | |
:impl ThreadData { | |
: pub fn new() -> Arc<Mutex<ThreadData>> { | |
: Arc::new(Mutex::new(ThreadData { | |
: entries: Vec::new(), | |
: task: None, | |
: })) | |
: } | |
:} | |
: | |
:struct Foo<F: Fn()> { | |
: c: F, | |
:} | |
: | |
:impl<F: Fn()> Future for Foo<F> { | |
: type Item = (); | |
: type Error = (); | |
: | |
: fn poll(&mut self) -> Poll<Self::Item, Self::Error> { | |
: (self.c)(); | |
: Ok(Async::NotReady) | |
: } | |
:} | |
: | |
:fn make_reader_threads<P: AsRef<Path> + Send + Sync>(path: P, | |
: total: usize) -> Vec<Arc<Mutex<ThreadData>>> { | |
: let mut thread_data = Vec::new(); | |
: for _ in 0..total { | |
: let data = ThreadData::new(); | |
: thread_data.push(data.clone()); | |
: let rpath = path.as_ref(); | |
: let ppath = rpath.to_path_buf(); | |
: thread::spawn(move || { | |
: let mut core = Core::new().unwrap(); | |
: let handle = core.handle(); | |
: let protocol = Http::new(); | |
: core.run(Foo { c: || { | |
: let client = { | |
: let mut data = data.lock().unwrap(); | |
: data.task = Some(task::park()); | |
: if data.entries.is_empty() { | |
: return | |
: } | |
: data.entries.remove(0) | |
: }; | |
: protocol.bind_connection(&handle, client.0, client.1, AlphaBravo::new(&ppath)); | |
: }}).unwrap(); | |
: }); | |
: } | |
: thread_data | |
:} | |
: | |
:fn serve<P: AsRef<Path> + Send + Sync>(addr: &SocketAddr, path: P, total: usize) { | |
: let thread_data = make_reader_threads(path, total); | |
: | |
: let mut core = Core::new().unwrap(); | |
: let handle = core.handle(); | |
: let listener = net2::TcpBuilder::new_v4().unwrap() | |
: .bind(addr).unwrap() | |
: .listen(1000).unwrap(); | |
: let listener = TcpListener::from_listener(listener, addr, &handle).unwrap(); | |
: let mut counter = 0; | |
: core.run(listener.incoming().for_each(move |(socket, addr)| { | |
: let ref entry = thread_data[counter]; | |
: /*{ | |
: entry.entries.lock().unwrap().push((socket, addr)); | |
: entry.blocker.notify_one(); | |
: }*/ | |
: { | |
: let mut entry = entry.lock().unwrap(); | |
: entry.entries.push((socket, addr)); | |
: if let Some(ref task) = entry.task { | |
: task.unpark(); | |
: } | |
: } | |
: counter += 1; | |
: if counter >= total { | |
: counter = 0; | |
: } | |
: Ok(()) | |
: })).unwrap(); | |
:} | |
: | |
:fn start_server<P: AsRef<Path> + Send + Sync>(nb_instances: usize, addr: &str, path: P) { | |
: println!("===> Starting server on {} threads", nb_instances); | |
: let addr = addr.parse().unwrap(); | |
: | |
: println!("=> Server listening on \"{}\"", addr); | |
: println!("=> Saving files in \"{}\"", path.as_ref().display()); | |
: serve(&addr, path, nb_instances); | |
:} | |
: | |
:fn main() { /* data::main::hc017c10f002da5c8 total: 295 0.0031 */ | |
: let num_cpus = num_cpus::get(); | |
: let num_cpus = if num_cpus > 4 { num_cpus - (num_cpus / 10) * 2 } else { num_cpus }; | |
: if let Some(path) = env::args().nth(1) { | |
: start_server(num_cpus, "127.0.0.1:8080", path); | |
: } else { | |
: println!("No path received as argument so files will be stored in \"/tmp/data-rs/\"."); | |
: println!("If you want to specify a path, just start like this: \"./http-server [PATH]\""); | |
: println!(""); | |
: start_server(num_cpus, "127.0.0.1:8080", "/tmp/data-rs/"); | |
: } | |
:} | |
: | |
:#[cfg(test)] | |
:mod tests { | |
: extern crate reqwest; | |
: extern crate tempdir; | |
: | |
: use std::thread; | |
: use std::time::Duration; | |
: use std::io::Read; | |
: use self::tempdir::TempDir; | |
: use ::num_cpus; | |
: | |
: // Get variable value | |
: fn get_var(var: &str, url: &str) -> reqwest::Response { | |
: match reqwest::get(&format!("http://{}/{}/0", url, var)) { | |
: Ok(x) => x, | |
: Err(e) => panic!("get_var failed: {}", e), | |
: } | |
: } | |
: | |
: // Create new variable | |
: fn set_var(var: &str, value: &[u8], url: &str) -> reqwest::Response { | |
: match reqwest::Client::new().unwrap() | |
: .request(reqwest::Method::Put, &format!("http://{}/{}/0", url, var)) | |
: .body(value) | |
: .send() { | |
: Ok(x) => x, | |
: Err(e) => panic!("set_var failed: {}", e), | |
: } | |
: } | |
: | |
: // Remove the specified variable | |
: fn remove_var(var: &str, url: &str) -> reqwest::Response { | |
: match reqwest::Client::new().unwrap() | |
: .request(reqwest::Method::Delete, | |
: &format!("http://{}/{}/0", url, var)) | |
: .send() { | |
: Ok(x) => x, | |
: Err(e) => panic!("remove_var failed: {}", e), | |
: } | |
: } | |
: | |
: fn check_var(var: &str, expected_value: &[u8], error: &str, url: &str) { | |
: let mut resp = get_var(var, url); | |
: assert_eq!(resp.status(), &reqwest::StatusCode::Ok); | |
: let mut data = Vec::new(); | |
: resp.read_to_end(&mut data).expect(&format!("{}: read_to_end failed", error)); | |
: assert_eq!(data.as_slice(), expected_value, | |
: "{}:\nexpected {:?}\ngot {:?}", error, expected_value, &data); | |
: } | |
: | |
: macro_rules! start_server { | |
: ($nb_thread:expr, $url:expr, $path:expr) => {{ | |
: let _server = thread::spawn(move || { | |
: ::start_server($nb_thread, $url, &$path); | |
: }); | |
: // waiting for server to start | |
: thread::sleep(Duration::from_millis(500)); | |
: $url | |
: }} | |
: } | |
: | |
: #[test] | |
: fn basic_tests() { | |
: let tmp_dir = TempDir::new("basic_tests").expect("create temp dir"); | |
: let url = start_server!(1, "127.0.0.1:1234", tmp_dir.path()); | |
: | |
: assert_eq!(get_var("test", url).status(), &reqwest::StatusCode::NotFound); | |
: assert_eq!(set_var("test", b"hoho", url).status(), &reqwest::StatusCode::Ok); | |
: check_var("test", b"hoho", "[set 'test']", url); | |
: assert_eq!(remove_var("test", url).status(), &reqwest::StatusCode::Ok); | |
: assert_eq!(get_var("test", url).status(), &reqwest::StatusCode::NotFound); | |
: } | |
: | |
: #[test] | |
: fn middle_tests() { | |
: let tmp_dir = TempDir::new("middle_tests").expect("create temp dir"); | |
: let url = start_server!(1, "127.0.0.1:1235", tmp_dir.path()); | |
: | |
: assert_eq!(get_var("test", url).status(), &reqwest::StatusCode::NotFound); | |
: assert_eq!(set_var("test", b"hoho", url).status(), &reqwest::StatusCode::Ok); | |
: check_var("test", b"hoho", "[set 'test'1]", url); | |
: assert_eq!(set_var("test", b"new value!", url).status(), &reqwest::StatusCode::Ok); | |
: check_var("test", b"new value!", "[set 'test'2]", url); | |
: assert_eq!(set_var("test", b"and another new value!", url).status(), &reqwest::StatusCode::Ok); | |
: check_var("test", b"and another new value!", "[set 'test'3]", url); | |
: | |
: assert_eq!(set_var("test2", b"and another new value!", url).status(), &reqwest::StatusCode::Ok); | |
: check_var("test2", b"and another new value!", "[set 'test2'1]", url); | |
: assert_eq!(set_var("test2", b"0123456789", url).status(), &reqwest::StatusCode::Ok); | |
: check_var("test2", b"0123456789", "[set 'test2'2]", url); | |
: assert_eq!(set_var("test", b"0123456789", url).status(), &reqwest::StatusCode::Ok); | |
: check_var("test", b"0123456789", "[set 'test'4]", url); | |
: | |
: assert_eq!(remove_var("test", url).status(), &reqwest::StatusCode::Ok); | |
: assert_eq!(get_var("test2", url).status(), &reqwest::StatusCode::Ok); | |
: assert_eq!(get_var("test", url).status(), &reqwest::StatusCode::NotFound); | |
: assert_eq!(remove_var("test2", url).status(), &reqwest::StatusCode::Ok); | |
: assert_eq!(get_var("test2", url).status(), &reqwest::StatusCode::NotFound); | |
: assert_eq!(get_var("test", url).status(), &reqwest::StatusCode::NotFound); | |
: } | |
: | |
: fn bomber(max: u32, mut start: u32, step: u32, url: &str) { | |
: while start < max { | |
: let s = format!("thread1-{}", start); | |
: assert_eq!(set_var(&s, b"0", url).status(), | |
: &reqwest::StatusCode::Ok); | |
: check_var(&s, b"0", | |
: &format!("[set '{}'{}]", s, start), | |
: url); | |
: start += step; | |
: } | |
: } | |
: | |
: #[test] | |
: fn bombing() { | |
: let tmp_dir = TempDir::new("bombing").expect("create temp dir"); | |
: let url = start_server!(num_cpus::get(), "127.0.0.1:1236", tmp_dir.path()); | |
: const MAX: u32 = 7500; | |
: | |
: let handle = thread::spawn(move || { | |
: bomber(MAX, 0, 4, url); | |
: }); | |
: let handle2 = thread::spawn(move || { | |
: bomber(MAX, 1, 4, url); | |
: }); | |
: let handle3 = thread::spawn(move || { | |
: bomber(MAX, 2, 4, url); | |
: }); | |
: bomber(MAX, 3, 4, url); | |
: handle.join().expect("join failed"); | |
: handle2.join().expect("join failed"); | |
: handle3.join().expect("join failed"); | |
: } | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/git/checkouts/hyper-817b53a166fc1c58/499c0d1/src/http/chunk.rs" | |
* | |
* 3028 0.0318 | |
*/ | |
:use std::fmt; | |
:use std::sync::Arc; | |
: | |
:use http::buf::MemSlice; | |
: | |
:/// A piece of a message body. | |
:pub struct Chunk(Inner); | |
: | |
:enum Inner { | |
: Owned(Vec<u8>), | |
: Referenced(Arc<Vec<u8>>), | |
: Mem(MemSlice), | |
: Static(&'static [u8]), | |
:} | |
: | |
:impl From<Vec<u8>> for Chunk { | |
: #[inline] | |
: fn from(v: Vec<u8>) -> Chunk { | |
: Chunk(Inner::Owned(v)) | |
: } | |
:} | |
: | |
:impl From<Arc<Vec<u8>>> for Chunk { | |
: #[inline] | |
: fn from(v: Arc<Vec<u8>>) -> Chunk { | |
: Chunk(Inner::Referenced(v)) | |
: } | |
:} | |
: | |
:impl From<&'static [u8]> for Chunk { | |
: #[inline] | |
: fn from(slice: &'static [u8]) -> Chunk { | |
: Chunk(Inner::Static(slice)) | |
: } | |
:} | |
: | |
:impl From<String> for Chunk { | |
: #[inline] | |
: fn from(s: String) -> Chunk { | |
: s.into_bytes().into() | |
: } | |
:} | |
: | |
:impl From<&'static str> for Chunk { | |
: #[inline] | |
: fn from(slice: &'static str) -> Chunk { | |
: slice.as_bytes().into() | |
: } | |
:} | |
: | |
:impl From<MemSlice> for Chunk { | |
1234 0.0130 : fn from(mem: MemSlice) -> Chunk { /* _$LT$hyper..http..chunk..Chunk$u20$as$u20$core..convert..From$LT$hyper..http..buf..MemSlice$GT$$GT$::from::h64f3bf8a0e7f6bd0 total: 2132 0.0224 */ | |
404 0.0042 : Chunk(Inner::Mem(mem)) | |
494 0.0052 : } | |
:} | |
: | |
:impl ::std::ops::Deref for Chunk { | |
: type Target = [u8]; | |
: | |
: #[inline] | |
: fn deref(&self) -> &Self::Target { | |
: self.as_ref() | |
: } | |
:} | |
: | |
:impl AsRef<[u8]> for Chunk { | |
: #[inline] | |
: fn as_ref(&self) -> &[u8] { | |
: match self.0 { | |
476 0.0050 : Inner::Owned(ref vec) => vec, | |
: Inner::Referenced(ref vec) => vec, | |
216 0.0023 : Inner::Mem(ref slice) => slice.as_ref(), | |
204 0.0021 : Inner::Static(slice) => slice, | |
: } | |
: } | |
:} | |
: | |
:impl fmt::Debug for Chunk { | |
: #[inline] | |
: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |
: fmt::Debug::fmt(self.as_ref(), f) | |
: } | |
:} | |
/* | |
* Total samples for file : "ADCE.cpp" | |
* | |
* 3014 0.0316 | |
*/ | |
<credited to line zero> 3014 0.0316 : | |
/* initializeADCELegacyPassPassOnce(llvm::PassRegistry&) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::ADCELegacyPass::~ADCELegacyPass() total: 1 1.0e-05 */ | |
/* aggressiveDCE(llvm::Function&) total: 2981 0.0313 */ | |
/* (anonymous namespace)::ADCELegacyPass::runOnFunction(llvm::Function&) total: 31 3.3e-04 */ | |
/* | |
* Total samples for file : "CallGraphSCCPass.cpp" | |
* | |
* 2955 0.0310 | |
*/ | |
<credited to line zero> 2955 0.0310 : | |
/* (anonymous namespace)::CGPassManager::getAsPMDataManager() total: 1 1.0e-05 */ | |
/* non-virtual thunk to (anonymous namespace)::CGPassManager::getAsPass() total: 2 2.1e-05 */ | |
/* (anonymous namespace)::CGPassManager::RefreshCallGraph(llvm::CallGraphSCC&, llvm::CallGraph&, bool) [clone .isra.165] [clone .constprop.197] total: 871 0.0091 */ | |
/* (anonymous namespace)::CGPassManager::RefreshCallGraph(llvm::CallGraphSCC&, llvm::CallGraph&, bool) [clone .isra.165] [clone .constprop.196] total: 1703 0.0179 */ | |
/* (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) total: 378 0.0040 */ | |
/* | |
* Total samples for file : "LiveDebugValues.cpp" | |
* | |
* 2906 0.0305 | |
*/ | |
<credited to line zero> 2906 0.0305 : | |
/* llvm::SparseBitVector<128u>::FindLowerBound(unsigned int) [clone .part.306] total: 19 2.0e-04 */ | |
/* (anonymous namespace)::isDbgValueDescribedByReg(llvm::MachineInstr const&) total: 40 4.2e-04 */ | |
/* llvm::SmallDenseMap<std::pair<llvm::DILocalVariable const*, llvm::DILocation const*>, unsigned int, 8u, llvm::DenseMapInfo<std::pair<llvm::DILocalVariable const*, llvm::DILocation const*> >, llvm::detail::DenseMapPair<std::pair<llvm::DILocalVariable const*, llvm::DILocation const*>, unsigned int> >::deallocateBuckets() [clone .part.260] total: 1 1.0e-05 */ | |
/* (anonymous namespace)::LiveDebugValues::UserValueScopes::~UserValueScopes() total: 11 1.2e-04 */ | |
/* std::_Rb_tree<(anonymous namespace)::LiveDebugValues::VarLoc, std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int>, std::_Select1st<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> >, std::less<(anonymous namespace)::LiveDebugValues::VarLoc>, std::allocator<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> > >::_M_erase(std::_Rb_tree_node<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> >*) total: 33 3.5e-04 */ | |
/* (anonymous namespace)::LiveDebugValues::UserValueScopes::UserValueScopes((anonymous namespace)::LiveDebugValues::UserValueScopes const&) total: 21 2.2e-04 */ | |
/* std::_Rb_tree_iterator<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> > std::_Rb_tree<(anonymous namespace)::LiveDebugValues::VarLoc, std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int>, std::_Select1st<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> >, std::less<(anonymous namespace)::LiveDebugValues::VarLoc>, std::allocator<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> > >::_M_insert_<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> >(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int>&&) total: 44 4.6e-04 */ | |
/* std::pair<std::_Rb_tree_iterator<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> >, bool> std::_Rb_tree<(anonymous namespace)::LiveDebugValues::VarLoc, std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int>, std::_Select1st<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> >, std::less<(anonymous namespace)::LiveDebugValues::VarLoc>, std::allocator<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> > >::_M_insert_unique<std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int> >(std::pair<(anonymous namespace)::LiveDebugValues::VarLoc const, unsigned int>&&) total: 6 6.3e-05 */ | |
/* (anonymous namespace)::LiveDebugValues::transferRegisterDef(llvm::MachineInstr&, (anonymous namespace)::LiveDebugValues::OpenRangesSet&, llvm::UniqueVector<(anonymous namespace)::LiveDebugValues::VarLoc> const&) [clone .isra.342] total: 1395 0.0146 */ | |
/* (anonymous namespace)::LiveDebugValues::transferDebugValue(llvm::MachineInstr const&, (anonymous namespace)::LiveDebugValues::OpenRangesSet&, llvm::UniqueVector<(anonymous namespace)::LiveDebugValues::VarLoc>&) total: 754 0.0079 */ | |
/* (anonymous namespace)::LiveDebugValues::transferTerminatorInst(llvm::MachineInstr&, (anonymous namespace)::LiveDebugValues::OpenRangesSet&, llvm::SmallDenseMap<llvm::MachineBasicBlock const*, llvm::SparseBitVector<128u>, 4u, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, llvm::SparseBitVector<128u> > >&, llvm::UniqueVector<(anonymous namespace)::LiveDebugValues::VarLoc> const&) [clone .isra.367] total: 124 0.0013 */ | |
/* (anonymous namespace)::LiveDebugValues::ExtendRanges(llvm::MachineFunction&) total: 452 0.0047 */ | |
/* (anonymous namespace)::LiveDebugValues::runOnMachineFunction(llvm::MachineFunction&) total: 6 6.3e-05 */ | |
/* | |
* Total samples for file : "/home/stb/data-rs/http-server/<assert macros>" | |
* | |
* 2800 0.0294 | |
*/ | |
/* | |
* Total samples for file : "DemandedBits.cpp" | |
* | |
* 2730 0.0287 | |
*/ | |
<credited to line zero> 2730 0.0287 : | |
/* llvm::DemandedBits::determineLiveOperandBits(llvm::Instruction const*, llvm::Instruction const*, unsigned int, llvm::APInt const&, llvm::APInt&, llvm::APInt&, llvm::APInt&, llvm::APInt&, llvm::APInt&)::{lambda(unsigned int, llvm::Value const*, llvm::Value const*)#1}::operator()(unsigned int, llvm::Value const*, llvm::Value const*) const total: 22 2.3e-04 */ | |
/* llvm::DemandedBits::performAnalysis() [clone .part.190] total: 2708 0.0284 */ | |
/* | |
* Total samples for file : "BasicAliasAnalysis.cpp" | |
* | |
* 2730 0.0287 | |
*/ | |
<credited to line zero> 2730 0.0287 : | |
/* isObjectSize(llvm::Value const*, unsigned long, llvm::DataLayout const&, llvm::TargetLibraryInfo const&) total: 2 2.1e-05 */ | |
/* isEscapeSource(llvm::Value const*) total: 421 0.0044 */ | |
/* isObjectSmallerThan(llvm::Value const*, unsigned long, llvm::DataLayout const&, llvm::TargetLibraryInfo const&) total: 393 0.0041 */ | |
/* getParent(llvm::Value const*) [clone .part.193] total: 46 4.8e-04 */ | |
/* notDifferentParent(llvm::Value const*, llvm::Value const*) total: 1177 0.0124 */ | |
/* isNonEscapingLocalObject(llvm::Value const*) total: 357 0.0037 */ | |
/* isIntrinsicCall(llvm::ImmutableCallSite, llvm::Intrinsic::ID) total: 334 0.0035 */ | |
/* | |
* Total samples for file : "APInt.cpp" | |
* | |
* 2516 0.0264 | |
*/ | |
<credited to line zero> 2516 0.0264 : | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.53] total: 61 6.4e-04 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.54] total: 2455 0.0258 */ | |
/* | |
* Total samples for file : "CodeGenPrepare.cpp" | |
* | |
* 2466 0.0259 | |
*/ | |
<credited to line zero> 2466 0.0259 : | |
/* (anonymous namespace)::AddressingModeMatcher::valueAlreadyLiveAtInst(llvm::Value*, llvm::Value*, llvm::Value*) [clone .isra.762] total: 9 9.4e-05 */ | |
/* (anonymous namespace)::AddressingModeMatcher::isProfitableToFoldIntoAddressingMode(llvm::Instruction*, (anonymous namespace)::ExtAddrMode&, (anonymous namespace)::ExtAddrMode&) [clone .isra.920] total: 19 2.0e-04 */ | |
/* (anonymous namespace)::CodeGenPrepare::optimizeCallInst(llvm::CallInst*, bool&) total: 296 0.0031 */ | |
/* llvm::SmallVectorTemplateBase<std::unique_ptr<(anonymous namespace)::TypePromotionTransaction::TypePromotionAction, std::default_delete<(anonymous namespace)::TypePromotionTransaction::TypePromotionAction> >, false>::destroy_range(std::unique_ptr<(anonymous namespace)::TypePromotionTransaction::TypePromotionAction, std::default_delete<(anonymous namespace)::TypePromotionTransaction::TypePromotionAction> >*, std::unique_ptr<(anonymous namespace)::TypePromotionTransaction::TypePromotionAction, std::default_delete<(anonymous namespace)::TypePromotionTransaction::TypePromotionAction> >*) total: 14 1.5e-04 */ | |
/* (anonymous namespace)::TypePromotionTransaction::commit() total: 6 6.3e-05 */ | |
/* (anonymous namespace)::TypePromotionTransaction::rollback((anonymous namespace)::TypePromotionTransaction::TypePromotionAction const*) total: 1 1.0e-05 */ | |
/* std::reverse_iterator<llvm::ilist_iterator<llvm::Instruction> >::operator*() const [clone .isra.373] total: 1 1.0e-05 */ | |
/* llvm::User::getOperand(unsigned int) const [clone .constprop.982] total: 30 3.1e-04 */ | |
/* (anonymous namespace)::CodeGenPrepare::stripInvariantGroupMetadata(llvm::Instruction&) [clone .isra.281] total: 14 1.5e-04 */ | |
/* llvm::ValueMapCallbackVH<llvm::Value*, llvm::Value*, llvm::ValueMapConfig<llvm::Value*, llvm::sys::SmartMutex<false> > >::ValueMapCallbackVH(llvm::Value*) [clone .constprop.965] total: 3 3.1e-05 */ | |
/* (anonymous namespace)::CodeGenPrepare::placeDbgValues(llvm::Function&) [clone .isra.876] total: 198 0.0021 */ | |
/* (anonymous namespace)::CodeGenPrepare::sinkAndCmp(llvm::Function&) [clone .isra.880] total: 2 2.1e-05 */ | |
/* llvm::CallInst::getArgOperand(unsigned int) const [clone .constprop.975] total: 73 7.7e-04 */ | |
/* (anonymous namespace)::CodeGenPrepare::optimizeLoadExt(llvm::LoadInst*) total: 81 8.5e-04 */ | |
/* (anonymous namespace)::CodeGenPrepare::~CodeGenPrepare() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::CodeGenPrepare::eliminateMostlyEmptyBlocks(llvm::Function&) [clone .isra.931] total: 36 3.8e-04 */ | |
/* CombineUAddWithOverflow(llvm::CmpInst*) total: 18 1.9e-04 */ | |
/* (anonymous namespace)::TypePromotionHelper::getAction(llvm::Instruction*, llvm::SmallPtrSet<llvm::Instruction*, 16u> const&, llvm::TargetLowering const&, llvm::DenseMap<llvm::Instruction*, llvm::PointerIntPair<llvm::Type*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Type*>, llvm::PointerIntPairInfo<llvm::Type*, 1u, llvm::PointerLikeTypeTraits<llvm::Type*> > >, llvm::DenseMapInfo<llvm::Instruction*>, llvm::detail::DenseMapPair<llvm::Instruction*, llvm::PointerIntPair<llvm::Type*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Type*>, llvm::PointerIntPairInfo<llvm::Type*, 1u, llvm::PointerLikeTypeTraits<llvm::Type*> > > > > const&) total: 7 7.3e-05 */ | |
/* (anonymous namespace)::CodeGenPrepare::extLdPromotion((anonymous namespace)::TypePromotionTransaction&, llvm::LoadInst*&, llvm::Instruction*&, llvm::SmallVectorImpl<llvm::Instruction*> const&, unsigned int) total: 6 6.3e-05 */ | |
/* (anonymous namespace)::FindAllMemoryUses(llvm::Instruction*, llvm::SmallVectorImpl<std::pair<llvm::Instruction*, unsigned int> >&, llvm::SmallPtrSetImpl<llvm::Instruction*>&, llvm::TargetMachine const&) total: 13 1.4e-04 */ | |
/* (anonymous namespace)::AddressingModeMatcher::matchOperationAddr(llvm::User*, unsigned int, unsigned int, bool*) [clone .part.919] total: 161 0.0017 */ | |
/* (anonymous namespace)::AddressingModeMatcher::matchAddr(llvm::Value*, unsigned int) total: 130 0.0014 */ | |
/* (anonymous namespace)::AddressingModeMatcher::matchScaledValue(llvm::Value*, long, unsigned int) total: 3 3.1e-05 */ | |
/* SinkCast(llvm::CastInst*) total: 78 8.2e-04 */ | |
/* OptimizeNoopCopyExpression(llvm::CastInst*, llvm::TargetLowering const&, llvm::DataLayout const&) total: 85 8.9e-04 */ | |
/* SinkCmpExpression(llvm::CmpInst*, llvm::TargetLowering const*) total: 16 1.7e-04 */ | |
/* OptimizeCmpExpression(llvm::CmpInst*, llvm::TargetLowering const*) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::CodeGenPrepare::splitBranchCondition(llvm::Function&) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::CodeGenPrepare::optimizeMemoryInst(llvm::Instruction*, llvm::Value*, llvm::Type*, unsigned int) total: 218 0.0023 */ | |
/* (anonymous namespace)::CodeGenPrepare::optimizeInst(llvm::Instruction*, bool&) total: 337 0.0035 */ | |
/* (anonymous namespace)::CodeGenPrepare::runOnFunction(llvm::Function&) [clone .part.935] total: 597 0.0063 */ | |
/* (anonymous namespace)::CodeGenPrepare::runOnFunction(llvm::Function&) total: 3 3.1e-05 */ | |
/* | |
* Total samples for file : "LegalizeDAG.cpp" | |
* | |
* 2388 0.0251 | |
*/ | |
<credited to line zero> 2388 0.0251 : | |
/* (anonymous namespace)::SelectionDAGLegalize::ReplacedNode(llvm::SDNode*) [clone .isra.231] total: 4 4.2e-05 */ | |
/* (anonymous namespace)::SelectionDAGLegalize::LegalizeLoadOps(llvm::SDNode*) total: 144 0.0015 */ | |
/* (anonymous namespace)::SelectionDAGLegalize::ReplaceNode(llvm::SDValue, llvm::SDValue) total: 42 4.4e-04 */ | |
/* (anonymous namespace)::SelectionDAGLegalize::LegalizeStoreOps(llvm::SDNode*) total: 79 8.3e-04 */ | |
/* (anonymous namespace)::SelectionDAGLegalize::ReplaceNode(llvm::SDNode*, llvm::SDValue const*) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::SelectionDAGLegalize::ExpandBUILD_VECTOR(llvm::SDNode*) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::SelectionDAGLegalize::ExpandNode(llvm::SDNode*) total: 8 8.4e-05 */ | |
/* (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) total: 2102 0.0221 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/elf/../sysdeps/generic/dl-hash.h" | |
* | |
* 2387 0.0251 | |
*/ | |
/* | |
* Total samples for file : "X86ISelDAGToDAG.cpp" | |
* | |
* 2278 0.0239 | |
*/ | |
<credited to line zero> 2278 0.0239 : | |
/* hasNoSignedComparisonUses(llvm::SDNode*) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::ComplexPatternFuncMutatesDAG() const total: 56 5.9e-04 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::CheckPatternPredicate(unsigned int) const total: 109 0.0011 */ | |
/* llvm::SDValue::SDValue(llvm::SDNode*, unsigned int) [clone .constprop.419] total: 1 1.0e-05 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::~X86DAGToDAGISel() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::getAddressOperands((anonymous namespace)::X86ISelAddressMode&, llvm::SDLoc const&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&) total: 147 0.0015 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::matchAddress(llvm::SDValue, (anonymous namespace)::X86ISelAddressMode&) [clone .part.393] total: 54 5.7e-04 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::selectTLSADDRAddr(llvm::SDValue, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::foldOffsetIntoAddress(unsigned long, (anonymous namespace)::X86ISelAddressMode&) [clone .isra.191] [clone .part.192] total: 36 3.8e-04 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::IsProfitableToFold(llvm::SDValue, llvm::SDNode*, llvm::SDNode*) const [clone .part.358] total: 4 4.2e-05 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::IsProfitableToFold(llvm::SDValue, llvm::SDNode*, llvm::SDNode*) const total: 11 1.2e-04 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::shouldAvoidImmediateInstFormsForSize(llvm::SDNode*) const [clone .isra.338] total: 8 8.4e-05 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::EmitFunctionEntryCode() total: 5 5.2e-05 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::CheckNodePredicate(llvm::SDNode*, unsigned int) const total: 323 0.0034 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::PreprocessISelDAG() total: 239 0.0025 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::matchAddressRecursively(llvm::SDValue, (anonymous namespace)::X86ISelAddressMode&, unsigned int) total: 289 0.0030 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::selectLEAAddr(llvm::SDValue, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&) total: 64 6.7e-04 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::selectLEA64_32Addr(llvm::SDValue, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::matchAdd(llvm::SDValue, (anonymous namespace)::X86ISelAddressMode&, unsigned int) total: 90 9.4e-04 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::selectAddr(llvm::SDNode*, llvm::SDValue, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&) total: 115 0.0012 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) total: 551 0.0058 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::CheckComplexPattern(llvm::SDNode*, llvm::SDNode*, llvm::SDValue, unsigned int, llvm::SmallVectorImpl<std::pair<llvm::SDValue, llvm::SDNode*> >&) total: 158 0.0017 */ | |
/* (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) total: 9 9.4e-05 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/future/then.rs" | |
* | |
* 2186 0.0230 | |
*/ | |
:use {Future, IntoFuture, Poll}; | |
:use super::chain::Chain; | |
: | |
:/// Future for the `then` combinator, chaining computations on the end of | |
:/// another future regardless of its outcome. | |
:/// | |
:/// This is created by the `Future::then` method. | |
:#[must_use = "futures do nothing unless polled"] | |
:pub struct Then<A, B, F> where A: Future, B: IntoFuture { | |
: state: Chain<A, B::Future, F>, | |
:} | |
: | |
:pub fn new<A, B, F>(future: A, f: F) -> Then<A, B, F> | |
: where A: Future, | |
: B: IntoFuture, | |
:{ | |
: Then { | |
: state: Chain::new(future, f), | |
: } | |
:} | |
: | |
:impl<A, B, F> Future for Then<A, B, F> | |
: where A: Future, | |
: B: IntoFuture, | |
: F: FnOnce(Result<A::Item, A::Error>) -> B, | |
:{ | |
: type Item = B::Item; | |
: type Error = B::Error; | |
: | |
1240 0.0130 : fn poll(&mut self) -> Poll<B::Item, B::Error> { /* _$LT$futures..future..then..Then$LT$A$C$$u20$B$C$$u20$F$GT$$u20$as$u20$futures..future..Future$GT$::poll::h0b7f80ae357f1165 total: 34260 0.3597 */ | |
2 2.1e-05 : self.state.poll(|a, f| { | |
2 2.1e-05 : Ok(Err(f(a).into_future())) | |
: }) | |
942 0.0099 : } | |
:} | |
/* | |
* Total samples for file : "X86ISelLowering.cpp" | |
* | |
* 2181 0.0229 | |
*/ | |
<credited to line zero> 2181 0.0229 : | |
/* _GLOBAL__sub_I_X86ISelLowering.cpp total: 1 1.0e-05 */ | |
/* isTargetShuffle(unsigned int) total: 2 2.1e-05 */ | |
/* MaterializeSETB(llvm::SDLoc const&, llvm::SDValue, llvm::SelectionDAG&, llvm::MVT) total: 1 1.0e-05 */ | |
/* isX86LogicalCmp(llvm::SDValue) [clone .isra.214] total: 16 1.7e-04 */ | |
/* llvm::SDNode::getValueType(unsigned int) const [clone .isra.232] [clone .constprop.1375] total: 1 1.0e-05 */ | |
/* peekThroughBitcasts(llvm::SDValue) total: 3 3.1e-05 */ | |
/* isTargetShuffleEquivalent(llvm::ArrayRef<int>, llvm::ArrayRef<int>) total: 1 1.0e-05 */ | |
/* llvm::SDValue::getOperand(unsigned int) const [clone .isra.240] total: 1 1.0e-05 */ | |
/* llvm::SDNode::getSimpleValueType(unsigned int) const [clone .constprop.1370] total: 1 1.0e-05 */ | |
/* llvm::SDValue::getValue(unsigned int) const [clone .isra.234] [clone .constprop.1367] total: 12 1.3e-04 */ | |
/* llvm::TargetLoweringBase::getPointerTy(llvm::DataLayout const&, unsigned int) const [clone .isra.290] [clone .constprop.1352] total: 19 2.0e-04 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.1380] total: 1347 0.0141 */ | |
/* GetTLSADDR(llvm::SelectionDAG&, llvm::SDValue, llvm::GlobalAddressSDNode*, llvm::SDValue*, llvm::EVT, unsigned int, unsigned char, bool) [clone .constprop.1304] total: 1 1.0e-05 */ | |
/* LowerXALUO(llvm::SDValue, llvm::SelectionDAG&) [clone .isra.946] total: 1 1.0e-05 */ | |
/* convertIntLogicToFPLogic(llvm::SDNode*, llvm::SelectionDAG&, llvm::X86Subtarget const&) total: 7 7.3e-05 */ | |
/* LowerATOMIC_FENCE(llvm::SDValue, llvm::X86Subtarget const&, llvm::SelectionDAG&) [clone .isra.1027] total: 3 3.1e-05 */ | |
/* combineBT(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&) total: 1 1.0e-05 */ | |
/* getZeroVector(llvm::MVT, llvm::X86Subtarget const&, llvm::SelectionDAG&, llvm::SDLoc const&) total: 1 1.0e-05 */ | |
/* OptimizeConditionalInDecrement(llvm::SDNode*, llvm::SelectionDAG&) total: 33 3.5e-04 */ | |
/* detectAVGPattern(llvm::SDValue, llvm::EVT, llvm::SelectionDAG&, llvm::X86Subtarget const&, llvm::SDLoc const&) [clone .isra.1145] total: 15 1.6e-04 */ | |
/* EmitKTEST(llvm::SDValue, llvm::SelectionDAG&, llvm::X86Subtarget const&) [clone .isra.949] total: 12 1.3e-04 */ | |
/* combineCompareEqual(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) [clone .isra.953] total: 16 1.7e-04 */ | |
/* getDivRem8(llvm::SDNode*, llvm::SelectionDAG&) total: 7 7.3e-05 */ | |
/* combineBitcast(llvm::SDNode*, llvm::SelectionDAG&, llvm::X86Subtarget const&) total: 3 3.1e-05 */ | |
/* combineShiftLeft(llvm::SDNode*, llvm::SelectionDAG&) total: 12 1.3e-04 */ | |
/* performShiftToAllZeros(llvm::SDNode*, llvm::SelectionDAG&, llvm::X86Subtarget const&) total: 7 7.3e-05 */ | |
/* LowerCMP_SWAP(llvm::SDValue, llvm::X86Subtarget const&, llvm::SelectionDAG&) total: 1 1.0e-05 */ | |
/* combineLoad(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) [clone .isra.978] total: 81 8.5e-04 */ | |
/* getCondAfterTruncWithZeroHighBitsInput(llvm::SDValue, llvm::SelectionDAG&) total: 1 1.0e-05 */ | |
/* combineSetCCAtomicArith(llvm::SDValue, llvm::X86::CondCode&, llvm::SelectionDAG&) [clone .isra.1187] total: 42 4.4e-04 */ | |
/* checkBoolTestSetCCCombine(llvm::SDValue, llvm::X86::CondCode&) [clone .isra.1025] total: 64 6.7e-04 */ | |
/* computeZeroableShuffleElements(llvm::ArrayRef<int>, llvm::SDValue, llvm::SDValue) total: 2 2.1e-05 */ | |
/* lowerVectorShuffleAsShift(llvm::SDLoc const&, llvm::MVT, llvm::SDValue, llvm::SDValue, llvm::ArrayRef<int>, llvm::X86Subtarget const&, llvm::SelectionDAG&) total: 3 3.1e-05 */ | |
/* lowerVectorShuffleAsElementInsertion(llvm::SDLoc const&, llvm::MVT, llvm::SDValue, llvm::SDValue, llvm::ArrayRef<int>, llvm::X86Subtarget const&, llvm::SelectionDAG&) total: 3 3.1e-05 */ | |
/* combineOr(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) total: 13 1.4e-04 */ | |
/* foldVectorXorShiftIntoCmp(llvm::SDNode*, llvm::SelectionDAG&, llvm::X86Subtarget const&) total: 3 3.1e-05 */ | |
/* RetCC_X86Common(unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&) total: 14 1.5e-04 */ | |
/* RetCC_X86_64_C(unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&) total: 10 1.0e-04 */ | |
/* RetCC_X86(unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&) total: 33 3.5e-04 */ | |
/* CC_X86_64_C(unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&) total: 72 7.6e-04 */ | |
/* CC_X86(unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&) total: 38 4.0e-04 */ | |
/* combineMul(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) total: 8 8.4e-05 */ | |
/* combineToExtendVectorInReg(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) total: 8 8.4e-05 */ | |
/* combineZext(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) total: 8 8.4e-05 */ | |
/* combineSext(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) total: 1 1.0e-05 */ | |
/* combineStore(llvm::SDNode*, llvm::SelectionDAG&, llvm::X86Subtarget const&) total: 63 6.6e-04 */ | |
/* LowerVSETCC(llvm::SDValue, llvm::X86Subtarget const&, llvm::SelectionDAG&) total: 1 1.0e-05 */ | |
/* combineSetCC(llvm::SDNode*, llvm::SelectionDAG&, llvm::X86Subtarget const&) total: 96 0.0010 */ | |
/* lowerV2I64VectorShuffle(llvm::SDLoc const&, llvm::ArrayRef<int>, llvm::SDValue, llvm::SDValue, llvm::X86Subtarget const&, llvm::SelectionDAG&) total: 1 1.0e-05 */ | |
/* combineTruncate(llvm::SDNode*, llvm::SelectionDAG&, llvm::X86Subtarget const&) total: 22 2.3e-04 */ | |
/* combineAnd(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) total: 29 3.0e-04 */ | |
/* foldXorTruncShiftIntoCmp(llvm::SDNode*, llvm::SelectionDAG&) total: 1 1.0e-05 */ | |
/* combineSelect(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) total: 12 1.3e-04 */ | |
/* combineCMov(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) [clone .isra.1189] total: 11 1.2e-04 */ | |
/* matchPermuteVectorShuffle(llvm::MVT, llvm::ArrayRef<int>, llvm::X86Subtarget const&, unsigned int&, llvm::MVT&, unsigned int&) total: 1 1.0e-05 */ | |
/* getTargetShuffleMask(llvm::SDNode*, llvm::MVT, bool, llvm::SmallVectorImpl<llvm::SDValue>&, llvm::SmallVectorImpl<int>&, bool&) total: 2 2.1e-05 */ | |
/* combineExtractVectorElt(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&) total: 1 1.0e-05 */ | |
/* getShuffleScalarElt(llvm::SDNode*, unsigned int, llvm::SelectionDAG&, unsigned int) total: 3 3.1e-05 */ | |
/* combineX86ShufflesRecursively(llvm::SDValue, llvm::SDValue, llvm::ArrayRef<int>, int, bool, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) total: 3 3.1e-05 */ | |
/* combineShuffle(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) total: 4 4.2e-05 */ | |
/* lowerVectorShuffle(llvm::SDValue, llvm::X86Subtarget const&, llvm::SelectionDAG&) total: 2 2.1e-05 */ | |
/* | |
* Total samples for file : "TailRecursionElimination.cpp" | |
* | |
* 2158 0.0227 | |
*/ | |
<credited to line zero> 2158 0.0227 : | |
/* llvm::DenseMap<llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType> >::grow(unsigned int) total: 58 6.1e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType> >, llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType> >::initEmpty() total: 42 4.4e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType> >, llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType> >::LookupBucketFor<llvm::BasicBlock*>(llvm::BasicBlock* const&, llvm::detail::DenseMapPair<llvm::BasicBlock*, markTails(llvm::Function&, bool&)::VisitType>*&) total: 19 2.0e-04 */ | |
/* findTRECandidate(llvm::Instruction*, bool, llvm::TargetTransformInfo const*) total: 52 5.5e-04 */ | |
/* markTails(llvm::Function&, bool&) total: 1790 0.0188 */ | |
/* eliminateTailRecursion(llvm::Function&, llvm::TargetTransformInfo const*) [clone .part.266] total: 154 0.0016 */ | |
/* (anonymous namespace)::TailCallElim::runOnFunction(llvm::Function&) total: 43 4.5e-04 */ | |
/* | |
* Total samples for file : "RegAllocGreedy.cpp" | |
* | |
* 2139 0.0225 | |
*/ | |
<credited to line zero> 2139 0.0225 : | |
/* llvm::normalizeSpillWeight(float, unsigned int, unsigned int) total: 9 9.4e-05 */ | |
/* (anonymous namespace)::RAGreedy::spiller() total: 4 4.2e-05 */ | |
/* non-virtual thunk to (anonymous namespace)::RAGreedy::spiller() total: 2 2.1e-05 */ | |
/* llvm::SmallVectorImpl<(anonymous namespace)::RAGreedy::RegInfo>::resize(unsigned long, (anonymous namespace)::RAGreedy::RegInfo const&) total: 12 1.3e-04 */ | |
/* llvm::SmallVectorImpl<(anonymous namespace)::RAGreedy::GlobalSplitCandidate>::resize(unsigned long) [clone .part.472] total: 35 3.7e-04 */ | |
/* (anonymous namespace)::RAGreedy::calcSpillCost() total: 3 3.1e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::RAGreedy::GlobalSplitCandidate, false>::destroy_range((anonymous namespace)::RAGreedy::GlobalSplitCandidate*, (anonymous namespace)::RAGreedy::GlobalSplitCandidate*) total: 20 2.1e-04 */ | |
/* (anonymous namespace)::RAGreedy::releaseMemory() total: 4 4.2e-05 */ | |
/* llvm::IndexedMap<(anonymous namespace)::RAGreedy::RegInfo, llvm::VirtReg2IndexFunctor>::operator[](unsigned int) total: 4 4.2e-05 */ | |
/* llvm::IndexedMap<(anonymous namespace)::RAGreedy::RegInfo, llvm::VirtReg2IndexFunctor>::operator[](unsigned int) const total: 2 2.1e-05 */ | |
/* (anonymous namespace)::RAGreedy::GlobalSplitCandidate::getBundles(llvm::SmallVectorImpl<unsigned int>&, unsigned int) total: 9 9.4e-05 */ | |
/* (anonymous namespace)::RAGreedy::calcGlobalSplitCost((anonymous namespace)::RAGreedy::GlobalSplitCandidate&) total: 322 0.0034 */ | |
/* (anonymous namespace)::RAGreedy::setStage(llvm::LiveInterval const&, (anonymous namespace)::RAGreedy::LiveRangeStage) [clone .isra.312] total: 3 3.1e-05 */ | |
/* (anonymous namespace)::RAGreedy::canReassign(llvm::LiveInterval&, unsigned int) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::RAGreedy::canEvictInterference(llvm::LiveInterval&, unsigned int, bool, (anonymous namespace)::RAGreedy::EvictionCost&) [clone .part.391] total: 87 9.1e-04 */ | |
/* (anonymous namespace)::RAGreedy::doRegionSplit(llvm::LiveInterval&, unsigned int, bool, llvm::SmallVectorImpl<unsigned int>&) total: 55 5.8e-04 */ | |
/* (anonymous namespace)::RAGreedy::growRegion((anonymous namespace)::RAGreedy::GlobalSplitCandidate&) total: 835 0.0088 */ | |
/* (anonymous namespace)::RAGreedy::evictInterference(llvm::LiveInterval&, unsigned int, llvm::SmallVectorImpl<unsigned int>&) total: 27 2.8e-04 */ | |
/* (anonymous namespace)::RAGreedy::tryEvict(llvm::LiveInterval&, llvm::AllocationOrder&, llvm::SmallVectorImpl<unsigned int>&, unsigned int) total: 87 9.1e-04 */ | |
/* (anonymous namespace)::RAGreedy::tryAssign(llvm::LiveInterval&, llvm::AllocationOrder&, llvm::SmallVectorImpl<unsigned int>&) total: 114 0.0012 */ | |
/* (anonymous namespace)::RAGreedy::addSplitConstraints(llvm::InterferenceCache::Cursor, llvm::BlockFrequency&) total: 181 0.0019 */ | |
/* (anonymous namespace)::RAGreedy::LRE_WillShrinkVirtReg(unsigned int) total: 1 1.0e-05 */ | |
/* non-virtual thunk to (anonymous namespace)::RAGreedy::LRE_WillShrinkVirtReg(unsigned int) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::RAGreedy::LRE_CanEraseVirtReg(unsigned int) total: 1 1.0e-05 */ | |
/* non-virtual thunk to (anonymous namespace)::RAGreedy::LRE_CanEraseVirtReg(unsigned int) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::RAGreedy::enqueue(std::priority_queue<std::pair<unsigned int, unsigned int>, std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int> > >, std::less<std::pair<unsigned int, unsigned int> > >&, llvm::LiveInterval*) total: 54 5.7e-04 */ | |
/* (anonymous namespace)::RAGreedy::enqueue(llvm::LiveInterval*) total: 5 5.2e-05 */ | |
/* non-virtual thunk to (anonymous namespace)::RAGreedy::enqueue(llvm::LiveInterval*) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::RAGreedy::dequeue() total: 23 2.4e-04 */ | |
/* non-virtual thunk to (anonymous namespace)::RAGreedy::dequeue() total: 5 5.2e-05 */ | |
/* (anonymous namespace)::RAGreedy::calcGapWeights(unsigned int, llvm::SmallVectorImpl<float>&) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::RAGreedy::tryHintRecoloring(llvm::LiveInterval&) [clone .isra.482] total: 15 1.6e-04 */ | |
/* (anonymous namespace)::RAGreedy::~RAGreedy() total: 2 2.1e-05 */ | |
/* (anonymous namespace)::RAGreedy::runOnMachineFunction(llvm::MachineFunction&) total: 38 4.0e-04 */ | |
/* (anonymous namespace)::RAGreedy::tryRegionSplit(llvm::LiveInterval&, llvm::AllocationOrder&, llvm::SmallVectorImpl<unsigned int>&) total: 61 6.4e-04 */ | |
/* (anonymous namespace)::RAGreedy::trySplit(llvm::LiveInterval&, llvm::AllocationOrder&, llvm::SmallVectorImpl<unsigned int>&) total: 21 2.2e-04 */ | |
/* (anonymous namespace)::RAGreedy::selectOrSplitImpl(llvm::LiveInterval&, llvm::SmallVectorImpl<unsigned int>&, llvm::SmallSet<unsigned int, 16u, std::less<unsigned int> >&, unsigned int) total: 64 6.7e-04 */ | |
/* (anonymous namespace)::RAGreedy::selectOrSplit(llvm::LiveInterval&, llvm::SmallVectorImpl<unsigned int>&) total: 16 1.7e-04 */ | |
/* non-virtual thunk to (anonymous namespace)::RAGreedy::selectOrSplit(llvm::LiveInterval&, llvm::SmallVectorImpl<unsigned int>&) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::RAGreedy::getAnalysisUsage(llvm::AnalysisUsage&) const total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "RegisterCoalescer.cpp" | |
* | |
* 2126 0.0223 | |
*/ | |
<credited to line zero> 2126 0.0223 : | |
/* (anonymous namespace)::JoinVals::followCopyChain(llvm::VNInfo const*) const total: 4 4.2e-05 */ | |
/* (anonymous namespace)::JoinVals::isPrunedValue(unsigned int, (anonymous namespace)::JoinVals&) total: 9 9.4e-05 */ | |
/* (anonymous namespace)::RegisterCoalescer::releaseMemory() total: 5 5.2e-05 */ | |
/* compareMBBPriority((anonymous namespace)::MBBPriorityInfo const*, (anonymous namespace)::MBBPriorityInfo const*) total: 45 4.7e-04 */ | |
/* llvm::SlotIndexes::getInstructionFromIndex(llvm::SlotIndex) const [clone .isra.327] total: 5 5.2e-05 */ | |
/* (anonymous namespace)::RegisterCoalescer::shrinkToUses(llvm::LiveInterval*, llvm::SmallVectorImpl<llvm::MachineInstr*>*) [clone .isra.422] total: 2 2.1e-05 */ | |
/* llvm::SlotIndex::getRegSlot(bool) const [clone .constprop.492] total: 1 1.0e-05 */ | |
/* llvm::SlotIndex::getRegSlot(bool) const [clone .constprop.491] total: 1 1.0e-05 */ | |
/* (anonymous namespace)::RegisterCoalescer::LRE_WillEraseInstruction(llvm::MachineInstr*) total: 8 8.4e-05 */ | |
/* non-virtual thunk to (anonymous namespace)::RegisterCoalescer::LRE_WillEraseInstruction(llvm::MachineInstr*) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::JoinVals::JoinVals(llvm::LiveRange&, unsigned int, unsigned int, unsigned int, llvm::SmallVectorImpl<llvm::VNInfo*>&, llvm::CoalescerPair const&, llvm::LiveIntervals*, llvm::TargetRegisterInfo const*, bool, bool) total: 175 0.0018 */ | |
/* (anonymous namespace)::RegisterCoalescer::eliminateDeadDefs() total: 5 5.2e-05 */ | |
/* (anonymous namespace)::JoinVals::eraseInstrs(llvm::SmallPtrSetImpl<llvm::MachineInstr*>&, llvm::SmallVectorImpl<unsigned int>&) total: 130 0.0014 */ | |
/* isMoveInstr(llvm::TargetRegisterInfo const&, llvm::MachineInstr const*, unsigned int&, unsigned int&, unsigned int&, unsigned int&) total: 86 9.0e-04 */ | |
/* llvm::Pass* llvm::callDefaultCtor<(anonymous namespace)::RegisterCoalescer>() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::JoinVals::resolveConflicts((anonymous namespace)::JoinVals&) total: 77 8.1e-04 */ | |
/* (anonymous namespace)::JoinVals::pruneValues((anonymous namespace)::JoinVals&, llvm::SmallVectorImpl<llvm::SlotIndex>&, bool) total: 102 0.0011 */ | |
/* (anonymous namespace)::JoinVals::computeAssignment(unsigned int, (anonymous namespace)::JoinVals&) total: 644 0.0068 */ | |
/* (anonymous namespace)::JoinVals::mapValues((anonymous namespace)::JoinVals&) total: 54 5.7e-04 */ | |
/* (anonymous namespace)::RegisterCoalescer::adjustCopiesBackFrom(llvm::CoalescerPair const&, llvm::MachineInstr*) total: 18 1.9e-04 */ | |
/* (anonymous namespace)::RegisterCoalescer::updateRegDefsUses(unsigned int, unsigned int, unsigned int) total: 121 0.0013 */ | |
/* (anonymous namespace)::RegisterCoalescer::removeCopyByCommutingDef(llvm::CoalescerPair const&, llvm::MachineInstr*) total: 10 1.0e-04 */ | |
/* (anonymous namespace)::RegisterCoalescer::reMaterializeTrivialDef(llvm::CoalescerPair const&, llvm::MachineInstr*, bool&) total: 62 6.5e-04 */ | |
/* (anonymous namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&) total: 217 0.0023 */ | |
/* (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>) total: 54 5.7e-04 */ | |
/* (anonymous namespace)::RegisterCoalescer::coalesceLocals() total: 6 6.3e-05 */ | |
/* (anonymous namespace)::RegisterCoalescer::runOnMachineFunction(llvm::MachineFunction&) total: 281 0.0030 */ | |
/* (anonymous namespace)::RegisterCoalescer::getAnalysisUsage(llvm::AnalysisUsage&) const total: 2 2.1e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/sys/unix/time.rs" | |
* | |
* 2119 0.0222 | |
*/ | |
/* std::sys::imp::time::Timespec::sub_timespec::h41a8e1243f2a3e8c total: 150 0.0016 */ | |
/* | |
* Total samples for file : "/home/stb/data-rs/http-server/<try_nb macros>" | |
* | |
* 2059 0.0216 | |
*/ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.6.4/src/token.rs" | |
* | |
* 2044 0.0215 | |
*/ | |
:/// Used to identify which `Evented` value is associated with an `Event` | |
:/// notification returned by `Poll`. | |
:#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | |
:pub struct Token(pub usize); | |
: | |
:impl From<usize> for Token { | |
: fn from(val: usize) -> Token { | |
: Token(val) | |
: } | |
:} | |
: | |
:impl From<Token> for usize { | |
1815 0.0191 : fn from(val: Token) -> usize { /* mio::token::_$LT$impl$u20$core..convert..From$LT$mio..token..Token$GT$$u20$for$u20$usize$GT$::from::h31ea72f2dacaeafb total: 2044 0.0215 */ | |
: val.0 | |
229 0.0024 : } | |
:} | |
/* | |
* Total samples for file : "InstCombineCompares.cpp" | |
* | |
* 2028 0.0213 | |
*/ | |
<credited to line zero> 2028 0.0213 : | |
/* ComputeSignedMinMaxValuesFromKnownBits(llvm::APInt const&, llvm::APInt const&, llvm::APInt&, llvm::APInt&) total: 39 4.1e-04 */ | |
/* ComputeUnsignedMinMaxValuesFromKnownBits(llvm::APInt const&, llvm::APInt const&, llvm::APInt&, llvm::APInt&) total: 760 0.0080 */ | |
/* llvm::getComplexity(llvm::Value*) total: 589 0.0062 */ | |
/* llvm::CmpInst::operator new(unsigned long) [clone .constprop.708] total: 1 1.0e-05 */ | |
/* llvm::User::getOperand(unsigned int) const [clone .constprop.700] total: 35 3.7e-04 */ | |
/* llvm::User::getOperand(unsigned int) const [clone .constprop.701] total: 223 0.0023 */ | |
/* llvm::BinaryOperator::getOperand(unsigned int) const [clone .constprop.711] total: 20 2.1e-04 */ | |
/* llvm::BinaryOperator::getOperand(unsigned int) const [clone .constprop.710] total: 1 1.0e-05 */ | |
/* bool llvm::PatternMatch::cst_pred_ty<llvm::PatternMatch::is_one>::match<llvm::Value>(llvm::Value*) [clone .isra.391] total: 3 3.1e-05 */ | |
/* bool llvm::PatternMatch::match_zero::match<llvm::Value>(llvm::Value*) [clone .isra.261] total: 13 1.4e-04 */ | |
/* llvm::Twine::Twine(char const*) [clone .constprop.709] total: 2 2.1e-05 */ | |
/* isSignBitCheck(llvm::CmpInst::Predicate, llvm::ConstantInt*, bool&) total: 154 0.0016 */ | |
/* transformToIndexedCompare(llvm::GEPOperator*, llvm::Value*, llvm::CmpInst::Predicate, llvm::DataLayout const&) total: 188 0.0020 */ | |
/* | |
* Total samples for file : "Attributes.cpp" | |
* | |
* 1994 0.0209 | |
*/ | |
<credited to line zero> 1994 0.0209 : | |
/* llvm::AttributeSet::get(llvm::LLVMContext&, unsigned int, llvm::AttrBuilder const&) [clone .part.167] total: 1994 0.0209 */ | |
/* | |
* Total samples for file : "InstCombineSimplifyDemanded.cpp" | |
* | |
* 1932 0.0203 | |
*/ | |
<credited to line zero> 1932 0.0203 : | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.248] total: 119 0.0012 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.249] total: 1305 0.0137 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.250] total: 273 0.0029 */ | |
/* ShrinkDemandedConstant(llvm::Instruction*, unsigned int, llvm::APInt) total: 235 0.0025 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/net/tcp.rs" | |
* | |
* 1906 0.0200 | |
*/ | |
/* _$LT$$RF$$u27$a$u20$std..net..tcp..TcpStream$u20$as$u20$std..io..Read$GT$::read::hf7d10295b4bb8288 total: 2998 0.0315 */ | |
/* _$LT$$RF$$u27$a$u20$std..net..tcp..TcpStream$u20$as$u20$std..io..Write$GT$::write::h4c579415594cb8bf total: 14 1.5e-04 */ | |
/* | |
* Total samples for file : "PromoteMemoryToRegister.cpp" | |
* | |
* 1855 0.0195 | |
*/ | |
<credited to line zero> 1855 0.0195 : | |
/* llvm::DenseMapIterator<std::pair<unsigned int, unsigned int>, llvm::PHINode*, llvm::DenseMapInfo<std::pair<unsigned int, unsigned int> >, llvm::detail::DenseMapPair<std::pair<unsigned int, unsigned int>, llvm::PHINode*>, false>::AdvancePastEmptyBuckets() [clone .isra.181] total: 17 1.8e-04 */ | |
/* void std::_Destroy_aux<false>::__destroy<(anonymous namespace)::RenamePassData*>((anonymous namespace)::RenamePassData*, (anonymous namespace)::RenamePassData*) total: 8 8.4e-05 */ | |
/* llvm::BasicBlock** std::__unguarded_partition<llvm::BasicBlock**, llvm::BasicBlock*, (anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}>((anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}, (anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}, llvm::BasicBlock* const&, (anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}) total: 1 1.0e-05 */ | |
/* void std::__insertion_sort<llvm::BasicBlock**, (anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}>(llvm::BasicBlock**, (anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}, (anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}) total: 18 1.9e-04 */ | |
/* void std::__introsort_loop<llvm::BasicBlock**, long, (anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}>(llvm::BasicBlock**, (anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}, long, (anonymous namespace)::PromoteMem2Reg::run()::{lambda(llvm::BasicBlock*, llvm::BasicBlock*)#1}) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::PromoteMem2Reg::ComputeLiveInBlocks(llvm::AllocaInst*, (anonymous namespace)::AllocaInfo&, llvm::SmallPtrSetImpl<llvm::BasicBlock*> const&, llvm::SmallPtrSetImpl<llvm::BasicBlock*>&) [clone .isra.378] total: 302 0.0032 */ | |
/* (anonymous namespace)::PromoteMem2Reg::PromoteMem2Reg(llvm::ArrayRef<llvm::AllocaInst*>, llvm::DominatorTree&, llvm::AliasSetTracker*, llvm::AssumptionCache*) total: 89 9.3e-04 */ | |
/* (anonymous namespace)::LargeBlockInfo::isInterestingInstruction(llvm::Instruction const*) total: 19 2.0e-04 */ | |
/* (anonymous namespace)::LargeBlockInfo::getInstructionIndex(llvm::Instruction const*) total: 439 0.0046 */ | |
/* rewriteSingleStoreAlloca(llvm::AllocaInst*, (anonymous namespace)::AllocaInfo&, (anonymous namespace)::LargeBlockInfo&, llvm::DominatorTree&, llvm::AliasSetTracker*) total: 200 0.0021 */ | |
/* promoteSingleBlockAlloca(llvm::AllocaInst*, (anonymous namespace)::AllocaInfo const&, (anonymous namespace)::LargeBlockInfo&, llvm::AliasSetTracker*) [clone .isra.400] total: 3 3.1e-05 */ | |
/* (anonymous namespace)::PromoteMem2Reg::RenamePass(llvm::BasicBlock*, llvm::BasicBlock*, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, std::vector<(anonymous namespace)::RenamePassData, std::allocator<(anonymous namespace)::RenamePassData> >&) total: 757 0.0079 */ | |
/* | |
* Total samples for file : "Metadata.cpp" | |
* | |
* 1850 0.0194 | |
*/ | |
<credited to line zero> 1850 0.0194 : | |
/* void std::__insertion_sort<std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> >*, llvm::ReplaceableMetadataImpl::replaceAllUsesWith(llvm::Metadata*)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}>(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> >*, llvm::ReplaceableMetadataImpl::replaceAllUsesWith(llvm::Metadata*)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}, llvm::ReplaceableMetadataImpl::replaceAllUsesWith(llvm::Metadata*)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}) total: 142 0.0015 */ | |
/* void std::__insertion_sort<std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> >*, llvm::ReplaceableMetadataImpl::resolveAllUses(bool)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}>(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> >*, llvm::ReplaceableMetadataImpl::resolveAllUses(bool)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}, llvm::ReplaceableMetadataImpl::resolveAllUses(bool)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}) total: 88 9.2e-04 */ | |
/* void std::__introsort_loop<std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> >*, long, llvm::ReplaceableMetadataImpl::replaceAllUsesWith(llvm::Metadata*)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}>(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> >*, llvm::ReplaceableMetadataImpl::replaceAllUsesWith(llvm::Metadata*)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}, long, llvm::ReplaceableMetadataImpl::replaceAllUsesWith(llvm::Metadata*)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}) total: 136 0.0014 */ | |
/* void std::__introsort_loop<std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> >*, long, llvm::ReplaceableMetadataImpl::resolveAllUses(bool)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}>(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> >*, llvm::ReplaceableMetadataImpl::resolveAllUses(bool)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}, long, llvm::ReplaceableMetadataImpl::resolveAllUses(bool)::{lambda(std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&, std::pair<void*, std::pair<llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*>, unsigned long> > const&)#1}) total: 45 4.7e-04 */ | |
/* void std::__merge_sort_with_buffer<std::pair<unsigned int, llvm::MDNode*>*, std::pair<unsigned int, llvm::MDNode*>*, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}>(std::pair<unsigned int, llvm::MDNode*>*, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}, std::pair<unsigned int, llvm::MDNode*>*, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}) total: 74 7.8e-04 */ | |
/* getLocalFunction(llvm::Value*) total: 18 1.9e-04 */ | |
/* llvm::ReplaceableMetadataImpl::resolveAllUses(bool) [clone .part.1116] total: 190 0.0020 */ | |
/* llvm::MDTuple* llvm::getUniqued<llvm::MDTuple, llvm::MDNodeInfo<llvm::MDTuple> >(llvm::DenseSet<llvm::MDTuple*, llvm::MDNodeInfo<llvm::MDTuple> >&, llvm::MDNodeInfo<llvm::MDTuple>::KeyTy const&) total: 189 0.0020 */ | |
/* void std::__merge_adaptive<std::pair<unsigned int, llvm::MDNode*>*, long, std::pair<unsigned int, llvm::MDNode*>*, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}>(std::pair<unsigned int, llvm::MDNode*>*, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}, long, std::pair<unsigned int, llvm::MDNode*>*, std::pair<unsigned int, llvm::MDNode*>*, std::pair<unsigned int, llvm::MDNode*>*, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}) total: 49 5.1e-04 */ | |
/* void std::__stable_sort_adaptive<std::pair<unsigned int, llvm::MDNode*>*, std::pair<unsigned int, llvm::MDNode*>*, long, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}>(std::pair<unsigned int, llvm::MDNode*>*, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}, std::pair<unsigned int, llvm::MDNode*>*, long, llvm::MDGlobalAttachmentMap::getAll(llvm::SmallVectorImpl<std::pair<unsigned int, llvm::MDNode*> >&) const::{lambda(std::pair<unsigned int, llvm::MDNode*> const&, std::pair<unsigned int, llvm::MDNode*> const&)#1}) total: 23 2.4e-04 */ | |
/* llvm::DenseSet<llvm::MDTuple*, llvm::MDNodeInfo<llvm::MDTuple> >::insert(llvm::MDTuple* const&) [clone .isra.967] total: 40 4.2e-04 */ | |
/* getOrSelfReference(llvm::LLVMContext&, llvm::ArrayRef<llvm::Metadata*>) total: 22 2.3e-04 */ | |
/* canonicalizeMetadataForValue(llvm::LLVMContext&, llvm::Metadata*) total: 396 0.0042 */ | |
/* llvm::DICompositeType* uniquifyImpl<llvm::DICompositeType, llvm::MDNodeInfo<llvm::DICompositeType> >(llvm::DICompositeType*, llvm::DenseSet<llvm::DICompositeType*, llvm::MDNodeInfo<llvm::DICompositeType> >&) total: 4 4.2e-05 */ | |
/* llvm::ReplaceableMetadataImpl::replaceAllUsesWith(llvm::Metadata*) [clone .part.1121] total: 434 0.0046 */ | |
/* | |
* Total samples for file : "Constants.cpp" | |
* | |
* 1811 0.0190 | |
*/ | |
<credited to line zero> 1811 0.0190 : | |
/* llvm::DenseMapAPIntKeyInfo::isEqual(llvm::APInt const&, llvm::APInt const&) [clone .part.51] total: 1409 0.0148 */ | |
/* canTrapImpl(llvm::Constant const*, llvm::SmallPtrSetImpl<llvm::ConstantExpr const*>&) total: 345 0.0036 */ | |
/* ConstHasGlobalValuePredicate(llvm::Constant const*, bool (*)(llvm::GlobalValue const*)) [clone .constprop.578] total: 2 2.1e-05 */ | |
/* ConstHasGlobalValuePredicate(llvm::Constant const*, bool (*)(llvm::GlobalValue const*)) [clone .constprop.577] total: 6 6.3e-05 */ | |
/* removeDeadUsersOfConstant(llvm::Constant const*) total: 49 5.1e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/liballoc_jemalloc/../jemalloc/include/jemalloc/internal/bitmap.h" | |
* | |
* 1787 0.0188 | |
*/ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/nptl/forward.c" | |
* | |
* 1730 0.0182 | |
*/ | |
/* pthread_mutex_init total: 1 1.0e-05 */ | |
/* pthread_mutex_lock total: 1393 0.0146 */ | |
/* pthread_mutex_unlock total: 336 0.0035 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/sync/mutex.rs" | |
* | |
* 1707 0.0179 | |
*/ | |
/* | |
* Total samples for file : "/home/stb/data-rs/http-server/<__thread_local_inner macros>" | |
* | |
* 1664 0.0175 | |
*/ | |
/* tokio_core::reactor::CURRENT_LOOP::FOO::__getit::h265873ca1a3ca0cd total: 1324 0.0139 */ | |
/* futures::task_impl::CURRENT_TASK::__getit::heeedc920d6bb6474 total: 340 0.0036 */ | |
/* | |
* Total samples for file : "CloneFunction.cpp" | |
* | |
* 1642 0.0172 | |
*/ | |
<credited to line zero> 1642 0.0172 : | |
/* llvm::DenseMapIterator<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >, llvm::WeakVH, llvm::DenseMapInfo<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > > >, llvm::detail::DenseMapPair<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >, llvm::WeakVH>, true>::DenseMapIterator(llvm::detail::DenseMapPair<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >, llvm::WeakVH> const*, llvm::detail::DenseMapPair<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >, llvm::WeakVH> const*, llvm::DebugEpochBase const&, bool) [clone .constprop.393] total: 27 2.8e-04 */ | |
/* llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >::ValueMapCallbackVH(llvm::Value*) [clone .constprop.394] total: 1 1.0e-05 */ | |
/* llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >::ValueMapCallbackVH(llvm::Value*) [clone .constprop.395] total: 5 5.2e-05 */ | |
/* llvm::ValueMap<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >::operator[](llvm::Value const* const&) [clone .isra.378] total: 311 0.0033 */ | |
/* (anonymous namespace)::PruningFunctionCloner::CloneBlock(llvm::BasicBlock const*, llvm::ilist_iterator<llvm::Instruction const>, std::vector<llvm::BasicBlock const*, std::allocator<llvm::BasicBlock const*> >&) total: 1298 0.0136 */ | |
/* | |
* Total samples for file : "SelectionDAG.cpp" | |
* | |
* 1626 0.0171 | |
*/ | |
<credited to line zero> 1626 0.0171 : | |
/* __gnu_cxx::__exchange_and_add_dispatch(int*, int) [clone .constprop.844] total: 1 1.0e-05 */ | |
/* AddNodeIDOperands(llvm::FoldingSetNodeID&, llvm::ArrayRef<llvm::SDValue>) total: 459 0.0048 */ | |
/* doNotCSE(llvm::SDNode*) total: 70 7.3e-04 */ | |
/* shouldLowerMemFuncForSize(llvm::MachineFunction const&) total: 2 2.1e-05 */ | |
/* llvm::SDValue::getValueType() const [clone .isra.137] total: 1 1.0e-05 */ | |
/* void* llvm::object_creator<(anonymous namespace)::EVTArray>() total: 3 3.1e-05 */ | |
/* llvm::SDNode::SDNode(unsigned int, unsigned int, llvm::DebugLoc, llvm::SDVTList) [clone .constprop.830] total: 125 0.0013 */ | |
/* llvm::APInt::APInt(unsigned int, unsigned long, bool) [clone .constprop.843] total: 122 0.0013 */ | |
/* FoldValue(unsigned int, llvm::APInt const&, llvm::APInt const&) total: 16 1.7e-04 */ | |
/* AddNodeIDCustom(llvm::FoldingSetNodeID&, llvm::SDNode const*) total: 574 0.0060 */ | |
/* llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>::Allocate(unsigned long, unsigned long) [clone .constprop.826] total: 184 0.0019 */ | |
/* FindOptimalMemOpLowering(std::vector<llvm::EVT, std::allocator<llvm::EVT> >&, unsigned int, unsigned long, unsigned int, unsigned int, bool, bool, bool, bool, unsigned int, unsigned int, llvm::SelectionDAG&, llvm::TargetLowering const&) [clone .isra.802] total: 11 1.2e-04 */ | |
/* getMemsetValue(llvm::SDValue, llvm::EVT, llvm::SelectionDAG&, llvm::SDLoc const&) total: 3 3.1e-05 */ | |
/* getMemcpyLoadsAndStores(llvm::SelectionDAG&, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue, llvm::SDValue, unsigned long, unsigned int, bool, bool, llvm::MachinePointerInfo, llvm::MachinePointerInfo) total: 55 5.8e-04 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/elf/../elf/dl-runtime.c" | |
* | |
* 1616 0.0170 | |
*/ | |
/* _dl_fixup total: 1622 0.0170 */ | |
/* | |
* Total samples for file : "InstCombineLoadStoreAlloca.cpp" | |
* | |
* 1575 0.0165 | |
*/ | |
<credited to line zero> 1575 0.0165 : | |
/* llvm::Twine::Twine(char const*) [clone .constprop.421] total: 3 3.1e-05 */ | |
/* canReplaceGEPIdxWithZero(llvm::InstCombiner&, llvm::GetElementPtrInst*, llvm::Instruction*, unsigned int&) total: 1067 0.0112 */ | |
/* llvm::IRBuilder<llvm::TargetFolder, llvm::InstCombineIRInserter>::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&) [clone .part.358] total: 5 5.2e-05 */ | |
/* combineStoreToNewValue(llvm::InstCombiner&, llvm::StoreInst&, llvm::Value*) [clone .isra.359] total: 8 8.4e-05 */ | |
/* combineLoadToNewType(llvm::InstCombiner&, llvm::LoadInst&, llvm::Type*, llvm::Twine const&) total: 15 1.6e-04 */ | |
/* unpackStoreToAggregate(llvm::InstCombiner&, llvm::StoreInst&) total: 346 0.0036 */ | |
/* equivalentAddressValues(llvm::Value*, llvm::Value*) total: 131 0.0014 */ | |
/* | |
* Total samples for file : "ValueEnumerator.cpp" | |
* | |
* 1573 0.0165 | |
*/ | |
<credited to line zero> 1573 0.0165 : | |
/* void std::__merge_sort_with_buffer<__gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, std::pair<llvm::Value const*, unsigned int>*, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}>(__gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}, std::pair<llvm::Value const*, unsigned int>*, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}) total: 3 3.1e-05 */ | |
/* llvm::DenseMapIterator<llvm::Type*, unsigned int, llvm::DenseMapInfo<llvm::Type*>, llvm::detail::DenseMapPair<llvm::Type*, unsigned int>, true>::DenseMapIterator(llvm::detail::DenseMapPair<llvm::Type*, unsigned int> const*, llvm::detail::DenseMapPair<llvm::Type*, unsigned int> const*, llvm::DebugEpochBase const&, bool) [clone .constprop.508] total: 20 2.1e-04 */ | |
/* isIntOrIntVectorValue(std::pair<llvm::Value const*, unsigned int> const&) total: 8 8.4e-05 */ | |
/* llvm::ValueEnumerator::MDIndex* std::__unguarded_partition<llvm::ValueEnumerator::MDIndex*, llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}>(llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}, llvm::ValueEnumerator::MDIndex const&, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}) total: 921 0.0097 */ | |
/* std::pair<llvm::Value const*, unsigned int>* std::__move_merge<__gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, __gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, std::pair<llvm::Value const*, unsigned int>*, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}>(__gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, std::pair<llvm::Value const*, unsigned int>*, __gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, __gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}) total: 64 6.7e-04 */ | |
/* __gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > > std::__move_merge<std::pair<llvm::Value const*, unsigned int>*, std::pair<llvm::Value const*, unsigned int>*, __gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}>(std::pair<llvm::Value const*, unsigned int>*, __gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, std::pair<llvm::Value const*, unsigned int>*, std::pair<llvm::Value const*, unsigned int>*, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}) total: 55 5.8e-04 */ | |
/* void std::__insertion_sort<__gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}>(__gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}) total: 62 6.5e-04 */ | |
/* getMetadataTypeOrder(llvm::Metadata const*) total: 128 0.0013 */ | |
/* llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}::operator()(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex) const total: 28 2.9e-04 */ | |
/* void std::__adjust_heap<llvm::ValueEnumerator::MDIndex*, long, llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}>(llvm::ValueEnumerator::MDIndex*, long, llvm::ValueEnumerator::MDIndex*, llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}) total: 9 9.4e-05 */ | |
/* void std::__move_median_to_first<llvm::ValueEnumerator::MDIndex*, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}>(llvm::ValueEnumerator::MDIndex*, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}) total: 8 8.4e-05 */ | |
/* void std::__introsort_loop<llvm::ValueEnumerator::MDIndex*, long, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}>(llvm::ValueEnumerator::MDIndex*, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}, long, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}) total: 8 8.4e-05 */ | |
/* void std::__unguarded_linear_insert<llvm::ValueEnumerator::MDIndex*, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}>(llvm::ValueEnumerator::MDIndex*, llvm::ValueEnumerator::organizeMetadata()::{lambda(llvm::ValueEnumerator::MDIndex, llvm::ValueEnumerator::MDIndex)#1}) total: 220 0.0023 */ | |
/* void std::__merge_adaptive<__gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, long, std::pair<llvm::Value const*, unsigned int>*, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}>(__gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}, long, __gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, std::pair<llvm::Value const*, unsigned int>*, __gnu_cxx::__normal_iterator<std::pair<llvm::Value const*, unsigned int>*, std::vector<std::pair<llvm::Value const*, unsigned int>, std::allocator<std::pair<llvm::Value const*, unsigned int> > > >, llvm::ValueEnumerator::OptimizeConstants(unsigned int, unsigned int)::{lambda(std::pair<llvm::Value const*, unsigned int> const&, std::pair<llvm::Value const*, unsigned int> const&)#1}) total: 21 2.2e-04 */ | |
/* llvm::ValueEnumerator::EnumerateMetadata(unsigned int, llvm::Metadata const*)::{lambda(llvm::Metadata const*)#1}::operator()(llvm::Metadata const*) const total: 18 1.9e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/libcollections/vec.rs" | |
* | |
* 1524 0.0160 | |
*/ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$GT$::reserve::h27122090647a3533 total: 448 0.0047 */ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$GT$::reserve::h22dc7b13012c8591 total: 1 1.0e-05 */ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$GT$::reserve::h25a22de1e56ada61 total: 16 1.7e-04 */ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$GT$::into_boxed_slice::h66bf9ae5fec6f83c total: 4 4.2e-05 */ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$GT$::into_boxed_slice::h66bf9ae5fec6f83c total: 270 0.0028 */ | |
/* _$LT$collections..vec..Vec$LT$u8$GT$$u20$as$u20$core..convert..From$LT$$RF$$u27$a$u20$str$GT$$GT$::from::h4f0ebd2ca010a6ae total: 103 0.0011 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/num/mod.rs" | |
* | |
* 1498 0.0157 | |
*/ | |
/* core::num::_$LT$impl$u20$u32$GT$::from_str_radix::h6fb31e3b12e82a62 total: 1 1.0e-05 */ | |
/* core::num::_$LT$impl$u20$u128$GT$::from_str_radix::hdf9cde1c67dd7bd6 total: 6 6.3e-05 */ | |
/* core::num::_$LT$impl$u20$usize$GT$::checked_next_power_of_two::h099549116cebe0e7 total: 625 0.0066 */ | |
/* core::num::_$LT$impl$u20$core..str..FromStr$u20$for$u20$u64$GT$::from_str::h2c5ce15b26d77bb4 total: 12 1.3e-04 */ | |
/* core::num::_$LT$impl$u20$core..str..FromStr$u20$for$u20$usize$GT$::from_str::h87257f2b2592a63c total: 2 2.1e-05 */ | |
/* core::num::_$LT$impl$u20$core..convert..TryFrom$LT$u64$GT$$u20$for$u20$usize$GT$::try_from::h8dab70863009445c total: 7 7.3e-05 */ | |
/* core::num::from_str_radix::h0b8c47d2c6615af7 total: 34 3.6e-04 */ | |
/* core::num::from_str_radix::h73ff528f8a345f97 total: 7 7.3e-05 */ | |
/* core::num::from_str_radix::h91aa609ca34b5e84 total: 1 1.0e-05 */ | |
/* core::num::from_str_radix::hc542d8fe85f8d4ab total: 5 5.2e-05 */ | |
/* | |
* Total samples for file : "DeadMachineInstructionElim.cpp" | |
* | |
* 1476 0.0155 | |
*/ | |
<credited to line zero> 1476 0.0155 : | |
/* (anonymous namespace)::DeadMachineInstructionElim::runOnMachineFunction(llvm::MachineFunction&) total: 1475 0.0155 */ | |
/* (anonymous namespace)::DeadMachineInstructionElim::getAnalysisUsage(llvm::AnalysisUsage&) const total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "FunctionAttrs.cpp" | |
* | |
* 1439 0.0151 | |
*/ | |
<credited to line zero> 1439 0.0151 : | |
/* initializePostOrderFunctionAttrsLegacyPassPassOnce(llvm::PassRegistry&) total: 1 1.0e-05 */ | |
/* llvm::DenseMap<(anonymous namespace)::ArgumentGraphNode*, unsigned int, llvm::DenseMapInfo<(anonymous namespace)::ArgumentGraphNode*>, llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int> >::grow(unsigned int) total: 31 3.3e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<(anonymous namespace)::ArgumentGraphNode*, unsigned int, llvm::DenseMapInfo<(anonymous namespace)::ArgumentGraphNode*>, llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int> >, (anonymous namespace)::ArgumentGraphNode*, unsigned int, llvm::DenseMapInfo<(anonymous namespace)::ArgumentGraphNode*>, llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int> >::LookupBucketFor<(anonymous namespace)::ArgumentGraphNode*>((anonymous namespace)::ArgumentGraphNode* const&, llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int> const*&) const total: 22 2.3e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<(anonymous namespace)::ArgumentGraphNode*, unsigned int, llvm::DenseMapInfo<(anonymous namespace)::ArgumentGraphNode*>, llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int> >, (anonymous namespace)::ArgumentGraphNode*, unsigned int, llvm::DenseMapInfo<(anonymous namespace)::ArgumentGraphNode*>, llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int> >::initEmpty() total: 71 7.5e-04 */ | |
/* void std::__advance<llvm::ilist_iterator<llvm::Argument>, long>(llvm::ilist_iterator<llvm::Argument>&, long, std::bidirectional_iterator_tag) [clone .isra.354] total: 6 6.3e-05 */ | |
/* void std::vector<llvm::scc_iterator<(anonymous namespace)::ArgumentGraph*, llvm::GraphTraits<(anonymous namespace)::ArgumentGraph*> >::StackElement, std::allocator<llvm::scc_iterator<(anonymous namespace)::ArgumentGraph*, llvm::GraphTraits<(anonymous namespace)::ArgumentGraph*> >::StackElement> >::_M_emplace_back_aux<llvm::scc_iterator<(anonymous namespace)::ArgumentGraph*, llvm::GraphTraits<(anonymous namespace)::ArgumentGraph*> >::StackElement>(llvm::scc_iterator<(anonymous namespace)::ArgumentGraph*, llvm::GraphTraits<(anonymous namespace)::ArgumentGraph*> >::StackElement&&) total: 24 2.5e-04 */ | |
/* void std::vector<(anonymous namespace)::ArgumentGraphNode*, std::allocator<(anonymous namespace)::ArgumentGraphNode*> >::_M_emplace_back_aux<(anonymous namespace)::ArgumentGraphNode* const&>((anonymous namespace)::ArgumentGraphNode* const&) total: 35 3.7e-04 */ | |
/* llvm::Optional<llvm::AAResults>::reset() [clone .part.208] total: 2 2.1e-05 */ | |
/* std::_Rb_tree<llvm::Argument*, std::pair<llvm::Argument* const, (anonymous namespace)::ArgumentGraphNode>, std::_Select1st<std::pair<llvm::Argument* const, (anonymous namespace)::ArgumentGraphNode> >, std::less<llvm::Argument*>, std::allocator<std::pair<llvm::Argument* const, (anonymous namespace)::ArgumentGraphNode> > >::_M_erase(std::_Rb_tree_node<std::pair<llvm::Argument* const, (anonymous namespace)::ArgumentGraphNode> >*) total: 18 1.9e-04 */ | |
/* llvm::SetVector<llvm::Function*, llvm::SmallVector<llvm::Function*, 8u>, llvm::SmallSet<llvm::Function*, 8u, std::less<llvm::Function*> > >::count(llvm::Function* const&) const [clone .isra.182] total: 2 2.1e-05 */ | |
/* llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int>* llvm::DenseMapBase<llvm::DenseMap<(anonymous namespace)::ArgumentGraphNode*, unsigned int, llvm::DenseMapInfo<(anonymous namespace)::ArgumentGraphNode*>, llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int> >, (anonymous namespace)::ArgumentGraphNode*, unsigned int, llvm::DenseMapInfo<(anonymous namespace)::ArgumentGraphNode*>, llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int> >::InsertIntoBucketImpl<(anonymous namespace)::ArgumentGraphNode*>((anonymous namespace)::ArgumentGraphNode* const&, (anonymous namespace)::ArgumentGraphNode* const&, llvm::detail::DenseMapPair<(anonymous namespace)::ArgumentGraphNode*, unsigned int>*) [clone .isra.391] total: 41 4.3e-04 */ | |
/* llvm::scc_iterator<(anonymous namespace)::ArgumentGraph*, llvm::GraphTraits<(anonymous namespace)::ArgumentGraph*> >::GetNextSCC() total: 71 7.5e-04 */ | |
/* (anonymous namespace)::ReversePostOrderFunctionAttrsLegacyPass::getAnalysisUsage(llvm::AnalysisUsage&) const total: 1 1.0e-05 */ | |
/* addNoRecurseAttrs(llvm::SmallSetVector<llvm::Function*, 8u> const&) total: 58 6.1e-04 */ | |
/* checkFunctionMemoryAccess(llvm::Function&, llvm::AAResults&, llvm::SmallSetVector<llvm::Function*, 8u> const&) [clone .part.432] total: 306 0.0032 */ | |
/* (anonymous namespace)::ArgumentUsesTracker::captured(llvm::Use const*) total: 12 1.3e-04 */ | |
/* determinePointerReadAttrs(llvm::Argument*, llvm::SmallPtrSet<llvm::Argument*, 8u> const&) total: 187 0.0020 */ | |
/* addArgumentAttrs(llvm::SmallSetVector<llvm::Function*, 8u> const&) total: 214 0.0022 */ | |
/* removeConvergentAttrs(llvm::SmallSetVector<llvm::Function*, 8u> const&) total: 28 2.9e-04 */ | |
/* addNonNullAttrs(llvm::SmallSetVector<llvm::Function*, 8u> const&) total: 64 6.7e-04 */ | |
/* isFunctionMallocLike(llvm::Function*, llvm::SmallSetVector<llvm::Function*, 8u> const&) total: 18 1.9e-04 */ | |
/* addNoAliasAttrs(llvm::SmallSetVector<llvm::Function*, 8u> const&) total: 51 5.4e-04 */ | |
/* llvm::Optional<llvm::BasicAAResult>::reset() [clone .part.348] total: 2 2.1e-05 */ | |
/* (anonymous namespace)::PostOrderFunctionAttrsLegacyPass::runOnSCC(llvm::CallGraphSCC&) [clone .part.433] total: 137 0.0014 */ | |
/* (anonymous namespace)::PostOrderFunctionAttrsLegacyPass::runOnSCC(llvm::CallGraphSCC&) total: 36 3.8e-04 */ | |
/* (anonymous namespace)::PostOrderFunctionAttrsLegacyPass::getAnalysisUsage(llvm::AnalysisUsage&) const total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/future/result.rs" | |
* | |
* 1407 0.0148 | |
*/ | |
://! Definition of the `Result` (immediately finished) combinator | |
: | |
:use core::result; | |
: | |
:use {Future, Poll, Async}; | |
: | |
:/// A future representing a value that is immediately ready. | |
:/// | |
:/// Created by the `done` function. | |
:#[must_use = "futures do nothing unless polled"] | |
:// TODO: rename this to `Result` on the next major version | |
:pub struct FutureResult<T, E> { | |
: inner: Option<result::Result<T, E>>, | |
:} | |
: | |
:/// Creates a new "leaf future" which will resolve with the given result. | |
:/// | |
:/// The returned future represents a computation which is finshed immediately. | |
:/// This can be useful with the `finished` and `failed` base future types to | |
:/// convert an immediate value to a future to interoperate elsewhere. | |
:/// | |
:/// # Examples | |
:/// | |
:/// ``` | |
:/// use futures::future::*; | |
:/// | |
:/// let future_of_1 = result::<u32, u32>(Ok(1)); | |
:/// let future_of_err_2 = result::<u32, u32>(Err(2)); | |
:/// ``` | |
:pub fn result<T, E>(r: result::Result<T, E>) -> FutureResult<T, E> { | |
825 0.0087 : FutureResult { inner: Some(r) } | |
:} | |
: | |
:/// Creates a "leaf future" from an immediate value of a finished and | |
:/// successful computation. | |
:/// | |
:/// The returned future is similar to `done` where it will immediately run a | |
:/// scheduled callback with the provided value. | |
:/// | |
:/// # Examples | |
:/// | |
:/// ``` | |
:/// use futures::future::*; | |
:/// | |
:/// let future_of_1 = ok::<u32, u32>(1); | |
:/// ``` | |
:pub fn ok<T, E>(t: T) -> FutureResult<T, E> { | |
: result(Ok(t)) | |
:} | |
: | |
:/// Creates a "leaf future" from an immediate value of a failed computation. | |
:/// | |
:/// The returned future is similar to `done` where it will immediately run a | |
:/// scheduled callback with the provided value. | |
:/// | |
:/// # Examples | |
:/// | |
:/// ``` | |
:/// use futures::future::*; | |
:/// | |
:/// let future_of_err_1 = err::<u32, u32>(1); | |
:/// ``` | |
:pub fn err<T, E>(e: E) -> FutureResult<T, E> { | |
: result(Err(e)) | |
:} | |
: | |
:impl<T, E> Future for FutureResult<T, E> { | |
: type Item = T; | |
: type Error = E; | |
: | |
: fn poll(&mut self) -> Poll<T, E> { | |
582 0.0061 : self.inner.take().expect("cannot poll Result twice").map(Async::Ready) | |
: } | |
:} | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.6.4/src/net/tcp.rs" | |
* | |
* 1394 0.0146 | |
*/ | |
://! Primitives for working with TCP | |
: | |
:use std::io::{Read, Write}; | |
:use std::net::{self, SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr}; | |
: | |
:use net2::TcpBuilder; | |
: | |
:use {io, sys, Evented, Ready, Poll, PollOpt, Token, IoVec}; | |
:use super::SelectorId; | |
: | |
:/* | |
: * | |
: * ===== TcpStream ===== | |
: * | |
: */ | |
: | |
:#[derive(Debug)] | |
:pub struct TcpStream { | |
: sys: sys::TcpStream, | |
: selector_id: SelectorId, | |
:} | |
: | |
:pub use std::net::Shutdown; | |
: | |
:impl TcpStream { | |
: /// Create a new TCP stream and issue a non-blocking connect to the | |
: /// specified address. | |
: /// | |
: /// This convenience method is available and uses the system's default | |
: /// options when creating a socket which is then connected. If fine-grained | |
: /// control over the creation of the socket is desired, you can use | |
: /// `net2::TcpBuilder` to configure a socket and then pass its socket to | |
: /// `TcpStream::connect_stream` to transfer ownership into mio and schedule | |
: /// the connect operation. | |
: pub fn connect(addr: &SocketAddr) -> io::Result<TcpStream> { | |
: let sock = try!(match *addr { | |
: SocketAddr::V4(..) => TcpBuilder::new_v4(), | |
: SocketAddr::V6(..) => TcpBuilder::new_v6(), | |
: }); | |
: // Required on Windows for a future `connect_overlapped` operation to be | |
: // executed successfully. | |
: if cfg!(windows) { | |
: try!(sock.bind(&inaddr_any(addr))); | |
: } | |
: TcpStream::connect_stream(try!(sock.to_tcp_stream()), addr) | |
: } | |
: | |
: /// Creates a new `TcpStream` from the pending socket inside the given | |
: /// `std::net::TcpBuilder`, connecting it to the address specified. | |
: /// | |
: /// This constructor allows configuring the socket before it's actually | |
: /// connected, and this function will transfer ownership to the returned | |
: /// `TcpStream` if successful. An unconnected `TcpStream` can be created | |
: /// with the `net2::TcpBuilder` type (and also configured via that route). | |
: /// | |
: /// The platform specific behavior of this function looks like: | |
: /// | |
: /// * On Unix, the socket is placed into nonblocking mode and then a | |
: /// `connect` call is issued. | |
: /// | |
: /// * On Windows, the address is stored internally and the connect operation | |
: /// is issued when the returned `TcpStream` is registered with an event | |
: /// loop. Note that on Windows you must `bind` a socket before it can be | |
: /// connected, so if a custom `TcpBuilder` is used it should be bound | |
: /// (perhaps to `INADDR_ANY`) before this method is called. | |
: pub fn connect_stream(stream: net::TcpStream, | |
: addr: &SocketAddr) -> io::Result<TcpStream> { | |
: Ok(TcpStream { | |
: sys: try!(sys::TcpStream::connect(stream, addr)), | |
: selector_id: SelectorId::new(), | |
: }) | |
: } | |
: | |
: /// Creates a new `TcpStream` from a standard `net::TcpStream`. | |
: /// | |
: /// This function is intended to be used to wrap a TCP stream from the | |
: /// standard library in the mio equivalent. The conversion here will | |
: /// automatically set `stream` to nonblocking and the returned object should | |
: /// be ready to get associated with an event loop. | |
: /// | |
: /// Note that the TCP stream here will not have `connect` called on it, so | |
: /// it should already be connected via some other means (be it manually, the | |
: /// net2 crate, or the standard library). | |
: pub fn from_stream(stream: net::TcpStream) -> io::Result<TcpStream> { | |
: try!(stream.set_nonblocking(true)); | |
: Ok(TcpStream { | |
: sys: sys::TcpStream::from_stream(stream), | |
: selector_id: SelectorId::new(), | |
: }) | |
: } | |
: | |
: /// Returns the socket address of the remote peer of this TCP connection. | |
: pub fn peer_addr(&self) -> io::Result<SocketAddr> { | |
: self.sys.peer_addr() | |
: } | |
: | |
: /// Returns the socket address of the local half of this TCP connection. | |
: pub fn local_addr(&self) -> io::Result<SocketAddr> { | |
: self.sys.local_addr() | |
: } | |
: | |
: /// Creates a new independently owned handle to the underlying socket. | |
: /// | |
: /// The returned `TcpStream` is a reference to the same stream that this | |
: /// object references. Both handles will read and write the same stream of | |
: /// data, and options set on one stream will be propagated to the other | |
: /// stream. | |
: pub fn try_clone(&self) -> io::Result<TcpStream> { | |
: self.sys.try_clone().map(|s| { | |
: TcpStream { | |
: sys: s, | |
: selector_id: self.selector_id.clone(), | |
: } | |
: }) | |
: } | |
: | |
: /// Shuts down the read, write, or both halves of this connection. | |
: /// | |
: /// This function will cause all pending and future I/O on the specified | |
: /// portions to return immediately with an appropriate value (see the | |
: /// documentation of `Shutdown`). | |
: pub fn shutdown(&self, how: Shutdown) -> io::Result<()> { | |
: self.sys.shutdown(how) | |
: } | |
: | |
: /// Sets the value of the `TCP_NODELAY` option on this socket. | |
: /// | |
: /// If set, this option disables the Nagle algorithm. This means that | |
: /// segments are always sent as soon as possible, even if there is only a | |
: /// small amount of data. When not set, data is buffered until there is a | |
: /// sufficient amount to send out, thereby avoiding the frequent sending of | |
: /// small packets. | |
: pub fn set_nodelay(&self, nodelay: bool) -> io::Result<()> { | |
: self.sys.set_nodelay(nodelay) | |
: } | |
: | |
: /// Gets the value of the `TCP_NODELAY` option on this socket. | |
: /// | |
: /// For more information about this option, see [`set_nodelay`][link]. | |
: /// | |
: /// [link]: #method.set_nodelay | |
: pub fn nodelay(&self) -> io::Result<bool> { | |
: self.sys.nodelay() | |
: } | |
: | |
: /// Sets whether keepalive messages are enabled to be sent on this socket. | |
: /// | |
: /// On Unix, this option will set the `SO_KEEPALIVE` as well as the | |
: /// `TCP_KEEPALIVE` or `TCP_KEEPIDLE` option (depending on your platform). | |
: /// On Windows, this will set the `SIO_KEEPALIVE_VALS` option. | |
: /// | |
: /// If `None` is specified then keepalive messages are disabled, otherwise | |
: /// the number of milliseconds specified will be the time to remain idle | |
: /// before sending a TCP keepalive probe. | |
: /// | |
: /// Some platforms specify this value in seconds, so sub-second millisecond | |
: /// specifications may be omitted. | |
: pub fn set_keepalive_ms(&self, keepalive: Option<u32>) -> io::Result<()> { | |
: self.sys.set_keepalive_ms(keepalive) | |
: } | |
: | |
: /// Returns whether keepalive messages are enabled on this socket, and if so | |
: /// the amount of milliseconds between them. | |
: /// | |
: /// For more information about this option, see [`set_keepalive_ms`][link]. | |
: /// | |
: /// [link]: #method.set_keepalive_ms | |
: pub fn keepalive_ms(&self) -> io::Result<Option<u32>> { | |
: self.sys.keepalive_ms() | |
: } | |
: | |
: /// Sets the value for the `IP_TTL` option on this socket. | |
: /// | |
: /// This value sets the time-to-live field that is used in every packet sent | |
: /// from this socket. | |
: pub fn set_ttl(&self, ttl: u32) -> io::Result<()> { | |
: self.sys.set_ttl(ttl) | |
: } | |
: | |
: /// Gets the value of the `IP_TTL` option for this socket. | |
: /// | |
: /// For more information about this option, see [`set_ttl`][link]. | |
: /// | |
: /// [link]: #method.set_ttl | |
: pub fn ttl(&self) -> io::Result<u32> { | |
: self.sys.ttl() | |
: } | |
: | |
: /// Get the value of the `SO_ERROR` option on this socket. | |
: /// | |
: /// This will retrieve the stored error in the underlying socket, clearing | |
: /// the field in the process. This can be useful for checking errors between | |
: /// calls. | |
: pub fn take_error(&self) -> io::Result<Option<io::Error>> { | |
: self.sys.take_error() | |
: } | |
: | |
: /// Read in a list of buffers all at once. | |
: /// | |
: /// This operation will attempt to read bytes from this socket and place | |
: /// them into the list of buffers provided. Note that each buffer is an | |
: /// `IoVec` which can be created from a byte slice. | |
: /// | |
: /// The buffers provided will be filled in sequentially. A buffer will be | |
: /// entirely filled up before the next is written to. | |
: /// | |
: /// The number of bytes read is returned, if successful, or an error is | |
: /// returned otherwise. If no bytes are available to be read yet then | |
: /// a "would block" error is returned. This operation does not block. | |
: /// | |
: /// On Unix this corresponds to the `readv` syscall. | |
: pub fn read_bufs(&self, bufs: &mut [&mut IoVec]) -> io::Result<usize> { | |
: self.sys.readv(bufs) | |
: } | |
: | |
: /// Write a list of buffers all at once. | |
: /// | |
: /// This operation will attempt to write a list of byte buffers to this | |
: /// socket. Note that each buffer is an `IoVec` which can be created from a | |
: /// byte slice. | |
: /// | |
: /// The buffers provided will be written sequentially. A buffer will be | |
: /// entirely written before the next is written. | |
: /// | |
: /// The number of bytes written is returned, if successful, or an error is | |
: /// returned otherwise. If the socket is not currently writable then a | |
: /// "would block" error is returned. This operation does not block. | |
: /// | |
: /// On Unix this corresponds to the `writev` syscall. | |
: pub fn write_bufs(&self, bufs: &[&IoVec]) -> io::Result<usize> { | |
: self.sys.writev(bufs) | |
: } | |
:} | |
: | |
:fn inaddr_any(other: &SocketAddr) -> SocketAddr { | |
: match *other { | |
: SocketAddr::V4(..) => { | |
: let any = Ipv4Addr::new(0, 0, 0, 0); | |
: let addr = SocketAddrV4::new(any, 0); | |
: SocketAddr::V4(addr) | |
: } | |
: SocketAddr::V6(..) => { | |
: let any = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0); | |
: let addr = SocketAddrV6::new(any, 0, 0, 0); | |
: SocketAddr::V6(addr) | |
: } | |
: } | |
:} | |
: | |
:impl Read for TcpStream { | |
820 0.0086 : fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { /* _$LT$mio..net..tcp..TcpStream$u20$as$u20$std..io..Read$GT$::read::h889af84ed1ac0032 total: 1501 0.0158 */ | |
: (&self.sys).read(buf) | |
560 0.0059 : } | |
:} | |
: | |
:impl<'a> Read for &'a TcpStream { | |
: fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { | |
: (&self.sys).read(buf) | |
: } | |
:} | |
: | |
:impl Write for TcpStream { | |
8 8.4e-05 : fn write(&mut self, buf: &[u8]) -> io::Result<usize> { /* _$LT$mio..net..tcp..TcpStream$u20$as$u20$std..io..Write$GT$::write::h08b078ed244ab523 total: 14 1.5e-04 */ | |
: (&self.sys).write(buf) | |
6 6.3e-05 : } | |
: | |
: fn flush(&mut self) -> io::Result<()> { | |
: (&self.sys).flush() | |
: } | |
:} | |
: | |
:impl<'a> Write for &'a TcpStream { | |
: fn write(&mut self, buf: &[u8]) -> io::Result<usize> { | |
: (&self.sys).write(buf) | |
: } | |
: | |
: fn flush(&mut self) -> io::Result<()> { | |
: (&self.sys).flush() | |
: } | |
:} | |
: | |
:impl Evented for TcpStream { | |
: fn register(&self, poll: &Poll, token: Token, | |
: interest: Ready, opts: PollOpt) -> io::Result<()> { | |
: try!(self.selector_id.associate_selector(poll)); | |
: self.sys.register(poll, token, interest, opts) | |
: } | |
: | |
: fn reregister(&self, poll: &Poll, token: Token, | |
: interest: Ready, opts: PollOpt) -> io::Result<()> { | |
: self.sys.reregister(poll, token, interest, opts) | |
: } | |
: | |
: fn deregister(&self, poll: &Poll) -> io::Result<()> { | |
: self.sys.deregister(poll) | |
: } | |
:} | |
: | |
:/* | |
: * | |
: * ===== TcpListener ===== | |
: * | |
: */ | |
: | |
:#[derive(Debug)] | |
:pub struct TcpListener { | |
: sys: sys::TcpListener, | |
: selector_id: SelectorId, | |
:} | |
: | |
:impl TcpListener { | |
: /// Convenience method to bind a new TCP listener to the specified address | |
: /// to receive new connections. | |
: /// | |
: /// This function will take the following steps: | |
: /// | |
: /// 1. Create a new TCP socket. | |
: /// 2. Set the `SO_REUSEADDR` option on the socket. | |
: /// 3. Bind the socket to the specified address. | |
: /// 4. Call `listen` on the socket to prepare it to receive new connections. | |
: /// | |
: /// If fine-grained control over the binding and listening process for a | |
: /// socket is desired then the `net2::TcpBuilder` methods can be used in | |
: /// combination with the `TcpListener::from_listener` method to transfer | |
: /// ownership into mio. | |
: pub fn bind(addr: &SocketAddr) -> io::Result<TcpListener> { | |
: // Create the socket | |
: let sock = try!(match *addr { | |
: SocketAddr::V4(..) => TcpBuilder::new_v4(), | |
: SocketAddr::V6(..) => TcpBuilder::new_v6(), | |
: }); | |
: | |
: // Set SO_REUSEADDR, but only on Unix (mirrors what libstd does) | |
: if cfg!(unix) { | |
: try!(sock.reuse_address(true)); | |
: } | |
: | |
: // Bind the socket | |
: try!(sock.bind(addr)); | |
: | |
: // listen | |
: let listener = try!(sock.listen(1024)); | |
: Ok(TcpListener { | |
: sys: try!(sys::TcpListener::new(listener, addr)), | |
: selector_id: SelectorId::new(), | |
: }) | |
: } | |
: | |
: /// Creates a new `TcpListener` from an instance of a | |
: /// `std::net::TcpListener` type. | |
: /// | |
: /// This function will set the `listener` provided into nonblocking mode on | |
: /// Unix, and otherwise the stream will just be wrapped up in an mio stream | |
: /// ready to accept new connections and become associated with an event | |
: /// loop. | |
: /// | |
: /// The address provided must be the address that the listener is bound to. | |
: pub fn from_listener(listener: net::TcpListener, addr: &SocketAddr) | |
: -> io::Result<TcpListener> { | |
: sys::TcpListener::new(listener, addr).map(|s| { | |
: TcpListener { | |
: sys: s, | |
: selector_id: SelectorId::new(), | |
: } | |
: }) | |
: } | |
: | |
: /// Accepts a new `TcpStream`. | |
: /// | |
: /// Returns a `Ok(None)` when the socket `WOULDBLOCK`, this means the stream | |
: /// will be ready at a later point. If an accepted stream is returned, the | |
: /// address of the peer is returned along with it | |
: pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> { | |
: self.sys.accept().map(|(s, a)| { | |
: let stream = TcpStream { | |
: sys: s, | |
: selector_id: SelectorId::new(), | |
: }; | |
: | |
: (stream, a) | |
: }) | |
: } | |
: | |
: /// Returns the local socket address of this listener. | |
: pub fn local_addr(&self) -> io::Result<SocketAddr> { | |
: self.sys.local_addr() | |
: } | |
: | |
: /// Creates a new independently owned handle to the underlying socket. | |
: /// | |
: /// The returned `TcpListener` is a reference to the same socket that this | |
: /// object references. Both handles can be used to accept incoming | |
: /// connections and options set on one listener will affect the other. | |
: pub fn try_clone(&self) -> io::Result<TcpListener> { | |
: self.sys.try_clone().map(|s| { | |
: TcpListener { | |
: sys: s, | |
: selector_id: self.selector_id.clone(), | |
: } | |
: }) | |
: } | |
: | |
: /// Sets the value for the `IP_TTL` option on this socket. | |
: /// | |
: /// This value sets the time-to-live field that is used in every packet sent | |
: /// from this socket. | |
: pub fn set_ttl(&self, ttl: u32) -> io::Result<()> { | |
: self.sys.set_ttl(ttl) | |
: } | |
: | |
: /// Gets the value of the `IP_TTL` option for this socket. | |
: /// | |
: /// For more information about this option, see [`set_ttl`][link]. | |
: /// | |
: /// [link]: #method.set_ttl | |
: pub fn ttl(&self) -> io::Result<u32> { | |
: self.sys.ttl() | |
: } | |
: | |
: /// Sets the value for the `IPV6_V6ONLY` option on this socket. | |
: /// | |
: /// If this is set to `true` then the socket is restricted to sending and | |
: /// receiving IPv6 packets only. In this case two IPv4 and IPv6 applications | |
: /// can bind the same port at the same time. | |
: /// | |
: /// If this is set to `false` then the socket can be used to send and | |
: /// receive packets from an IPv4-mapped IPv6 address. | |
: pub fn set_only_v6(&self, only_v6: bool) -> io::Result<()> { | |
: self.sys.set_only_v6(only_v6) | |
: } | |
: | |
: /// Gets the value of the `IPV6_V6ONLY` option for this socket. | |
: /// | |
: /// For more information about this option, see [`set_only_v6`][link]. | |
: /// | |
: /// [link]: #method.set_only_v6 | |
: pub fn only_v6(&self) -> io::Result<bool> { | |
: self.sys.only_v6() | |
: } | |
: | |
: /// Get the value of the `SO_ERROR` option on this socket. | |
: /// | |
: /// This will retrieve the stored error in the underlying socket, clearing | |
: /// the field in the process. This can be useful for checking errors between | |
: /// calls. | |
: pub fn take_error(&self) -> io::Result<Option<io::Error>> { | |
: self.sys.take_error() | |
: } | |
:} | |
: | |
:impl Evented for TcpListener { | |
: fn register(&self, poll: &Poll, token: Token, | |
: interest: Ready, opts: PollOpt) -> io::Result<()> { | |
: try!(self.selector_id.associate_selector(poll)); | |
: self.sys.register(poll, token, interest, opts) | |
: } | |
: | |
: fn reregister(&self, poll: &Poll, token: Token, | |
: interest: Ready, opts: PollOpt) -> io::Result<()> { | |
: self.sys.reregister(poll, token, interest, opts) | |
: } | |
: | |
: fn deregister(&self, poll: &Poll) -> io::Result<()> { | |
: self.sys.deregister(poll) | |
: } | |
:} | |
: | |
:/* | |
: * | |
: * ===== UNIX ext ===== | |
: * | |
: */ | |
: | |
:#[cfg(unix)] | |
:use std::os::unix::io::{IntoRawFd, AsRawFd, FromRawFd, RawFd}; | |
: | |
:#[cfg(unix)] | |
:impl IntoRawFd for TcpStream { | |
: fn into_raw_fd(self) -> RawFd { | |
: self.sys.into_raw_fd() | |
: } | |
:} | |
: | |
:#[cfg(unix)] | |
:impl AsRawFd for TcpStream { | |
: fn as_raw_fd(&self) -> RawFd { | |
: self.sys.as_raw_fd() | |
: } | |
:} | |
: | |
:#[cfg(unix)] | |
:impl FromRawFd for TcpStream { | |
: unsafe fn from_raw_fd(fd: RawFd) -> TcpStream { | |
: TcpStream { | |
: sys: FromRawFd::from_raw_fd(fd), | |
: selector_id: SelectorId::new(), | |
: } | |
: } | |
:} | |
: | |
:#[cfg(unix)] | |
:impl IntoRawFd for TcpListener { | |
: fn into_raw_fd(self) -> RawFd { | |
: self.sys.into_raw_fd() | |
: } | |
:} | |
: | |
:#[cfg(unix)] | |
:impl AsRawFd for TcpListener { | |
: fn as_raw_fd(&self) -> RawFd { | |
: self.sys.as_raw_fd() | |
: } | |
:} | |
: | |
:#[cfg(unix)] | |
:impl FromRawFd for TcpListener { | |
: unsafe fn from_raw_fd(fd: RawFd) -> TcpListener { | |
: TcpListener { | |
: sys: FromRawFd::from_raw_fd(fd), | |
: selector_id: SelectorId::new(), | |
: } | |
: } | |
:} | |
/* | |
* Total samples for file : "StackColoring.cpp" | |
* | |
* 1380 0.0145 | |
*/ | |
<credited to line zero> 1380 0.0145 : | |
/* llvm::DenseMap<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> >::grow(unsigned int) total: 5 5.2e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> >, llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> >::initEmpty() total: 7 7.3e-05 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> >, llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> >::LookupBucketFor<llvm::MachineBasicBlock const*>(llvm::MachineBasicBlock const* const&, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> const*&) const total: 87 9.1e-04 */ | |
/* llvm::Statistic::operator+=(unsigned int) [clone .part.100] total: 1 1.0e-05 */ | |
/* (anonymous namespace)::StackColoring::BlockLifetimeInfo::~BlockLifetimeInfo() total: 1 1.0e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> >, llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> >::destroyAll() total: 11 1.2e-04 */ | |
/* (anonymous namespace)::StackColoring::applyFirstUse(int) total: 6 6.3e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> >, llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo, llvm::DenseMapInfo<llvm::MachineBasicBlock const*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo> >::InsertIntoBucket(llvm::MachineBasicBlock const*&&, (anonymous namespace)::StackColoring::BlockLifetimeInfo&&, llvm::detail::DenseMapPair<llvm::MachineBasicBlock const*, (anonymous namespace)::StackColoring::BlockLifetimeInfo>*) total: 13 1.4e-04 */ | |
/* void std::__insertion_sort<int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}>(int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}) total: 3 3.1e-05 */ | |
/* void std::__merge_sort_loop<int*, int*, long, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}>(int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}, int*, long, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}) total: 2 2.1e-05 */ | |
/* void std::__merge_sort_with_buffer<int*, int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}>(int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}, int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}) total: 1 1.0e-05 */ | |
/* llvm::BitVector::resize(unsigned int, bool) [clone .constprop.520] total: 6 6.3e-05 */ | |
/* (anonymous namespace)::StackColoring::calculateLocalLiveness() total: 177 0.0019 */ | |
/* (anonymous namespace)::StackColoring::isLifetimeStartOrEnd(llvm::MachineInstr const&, llvm::SmallVector<int, 4u>&, bool&) total: 322 0.0034 */ | |
/* (anonymous namespace)::StackColoring::~StackColoring() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::StackColoring::collectMarkers(unsigned int) total: 334 0.0035 */ | |
/* (anonymous namespace)::StackColoring::remapInstructions(llvm::DenseMap<int, int, llvm::DenseMapInfo<int>, llvm::detail::DenseMapPair<int, int> >&) total: 161 0.0017 */ | |
/* void std::__merge_adaptive<int*, long, int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}>(int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}, long, int*, int*, int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}) total: 9 9.4e-05 */ | |
/* void std::__stable_sort_adaptive<int*, int*, long, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}>(int*, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}, int*, long, (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&)::{lambda(int, int)#1}) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::StackColoring::runOnMachineFunction(llvm::MachineFunction&) total: 230 0.0024 */ | |
/* (anonymous namespace)::StackColoring::getAnalysisUsage(llvm::AnalysisUsage&) const total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/ops.rs" | |
* | |
* 1364 0.0143 | |
*/ | |
/* | |
* Total samples for file : "MachineCopyPropagation.cpp" | |
* | |
* 1355 0.0142 | |
*/ | |
<credited to line zero> 1355 0.0142 : | |
/* (anonymous namespace)::MachineCopyPropagation::eraseIfRedundant(llvm::MachineInstr&, unsigned int, unsigned int) total: 15 1.6e-04 */ | |
/* removeClobberedRegsFromMap(llvm::DenseMap<unsigned int, llvm::MachineInstr*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, llvm::MachineInstr*> >&, llvm::MachineOperand const&) total: 43 4.5e-04 */ | |
/* (anonymous namespace)::MachineCopyPropagation::getRequiredProperties() const total: 2 2.1e-05 */ | |
/* (anonymous namespace)::MachineCopyPropagation::ClobberRegister(unsigned int) total: 324 0.0034 */ | |
/* llvm::Pass* llvm::callDefaultCtor<(anonymous namespace)::MachineCopyPropagation>() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::MachineCopyPropagation::CopyPropagateBlock(llvm::MachineBasicBlock&) total: 966 0.0101 */ | |
/* (anonymous namespace)::MachineCopyPropagation::runOnMachineFunction(llvm::MachineFunction&) total: 4 4.2e-05 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.0/src/lib.rs" | |
* | |
* 1340 0.0141 | |
*/ | |
:// Copyright 2014-2015 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. | |
: | |
://! Scoped thread-local storage | |
://! | |
://! This module provides the ability to generate *scoped* thread-local | |
://! variables. In this sense, scoped indicates that thread local storage | |
://! actually stores a reference to a value, and this reference is only placed | |
://! in storage for a scoped amount of time. | |
://! | |
://! There are no restrictions on what types can be placed into a scoped | |
://! variable, but all scoped variables are initialized to the equivalent of | |
://! null. Scoped thread local storage is useful when a value is present for a known | |
://! period of time and it is not required to relinquish ownership of the | |
://! contents. | |
://! | |
://! # Examples | |
://! | |
://! ``` | |
://! #[macro_use] | |
://! extern crate scoped_tls; | |
://! | |
://! scoped_thread_local!(static FOO: u32); | |
://! | |
://! # fn main() { | |
://! // Initially each scoped slot is empty. | |
://! assert!(!FOO.is_set()); | |
://! | |
://! // When inserting a value, the value is only in place for the duration | |
://! // of the closure specified. | |
://! FOO.set(&1, || { | |
://! FOO.with(|slot| { | |
://! assert_eq!(*slot, 1); | |
://! }); | |
://! }); | |
://! # } | |
://! ``` | |
: | |
:#![deny(missing_docs, warnings)] | |
: | |
:use std::cell::Cell; | |
:use std::marker; | |
:use std::thread::LocalKey; | |
: | |
:#[macro_export] | |
:macro_rules! scoped_thread_local { | |
: (static $name:ident: $ty:ty) => ( | |
: static $name: $crate::ScopedKey<$ty> = $crate::ScopedKey { | |
: inner: { | |
: thread_local!(static FOO: ::std::cell::Cell<usize> = { | |
: ::std::cell::Cell::new(0) | |
: }); | |
: &FOO | |
: }, | |
: _marker: ::std::marker::PhantomData, | |
: }; | |
: ) | |
:} | |
: | |
:/// Type representing a thread local storage key corresponding to a reference | |
:/// to the type parameter `T`. | |
:/// | |
:/// Keys are statically allocated and can contain a reference to an instance of | |
:/// type `T` scoped to a particular lifetime. Keys provides two methods, `set` | |
:/// and `with`, both of which currently use closures to control the scope of | |
:/// their contents. | |
:pub struct ScopedKey<T> { | |
: #[doc(hidden)] | |
: pub inner: &'static LocalKey<Cell<usize>>, | |
: #[doc(hidden)] | |
: pub _marker: marker::PhantomData<T>, | |
:} | |
: | |
:unsafe impl<T> Sync for ScopedKey<T> {} | |
: | |
:impl<T> ScopedKey<T> { | |
: /// Inserts a value into this scoped thread local storage slot for a | |
: /// duration of a closure. | |
: /// | |
: /// While `cb` is running, the value `t` will be returned by `get` unless | |
: /// this function is called recursively inside of `cb`. | |
: /// | |
: /// Upon return, this function will restore the previous value, if any | |
: /// was available. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ``` | |
: /// #[macro_use] | |
: /// extern crate scoped_tls; | |
: /// | |
: /// scoped_thread_local!(static FOO: u32); | |
: /// | |
: /// # fn main() { | |
: /// FOO.set(&100, || { | |
: /// let val = FOO.with(|v| *v); | |
: /// assert_eq!(val, 100); | |
: /// | |
: /// // set can be called recursively | |
: /// FOO.set(&101, || { | |
: /// // ... | |
: /// }); | |
: /// | |
: /// // Recursive calls restore the previous value. | |
: /// let val = FOO.with(|v| *v); | |
: /// assert_eq!(val, 100); | |
: /// }); | |
: /// # } | |
: /// ``` | |
: pub fn set<F, R>(&'static self, t: &T, f: F) -> R | |
: where F: FnOnce() -> R | |
: { | |
: struct Reset { | |
: key: &'static LocalKey<Cell<usize>>, | |
: val: usize, | |
: } | |
: impl Drop for Reset { | |
562 0.0059 : fn drop(&mut self) { /* _$LT$$LT$scoped_tls..ScopedKey$LT$T$GT$$GT$..set..Reset$u20$as$u20$core..ops..Drop$GT$::drop::hab21da7a81225005 total: 1350 0.0142 */ | |
219 0.0023 : self.key.with(|c| c.set(self.val)); | |
307 0.0032 : } | |
: } | |
: let prev = self.inner.with(|c| { | |
: let prev = c.get(); | |
: c.set(t as *const T as usize); | |
: prev | |
: }); | |
110 0.0012 : let _reset = Reset { key: self.inner, val: prev }; | |
: f() | |
133 0.0014 : } | |
: | |
: /// Gets a value out of this scoped variable. | |
: /// | |
: /// This function takes a closure which receives the value of this | |
: /// variable. | |
: /// | |
: /// # Panics | |
: /// | |
: /// This function will panic if `set` has not previously been called. | |
: /// | |
: /// # Examples | |
: /// | |
: /// ```no_run | |
: /// #[macro_use] | |
: /// extern crate scoped_tls; | |
: /// | |
: /// scoped_thread_local!(static FOO: u32); | |
: /// | |
: /// # fn main() { | |
: /// FOO.with(|slot| { | |
: /// // work with `slot` | |
: /// # drop(slot); | |
: /// }); | |
: /// # } | |
: /// ``` | |
: pub fn with<F, R>(&'static self, f: F) -> R | |
: where F: FnOnce(&T) -> R | |
: { | |
1 1.0e-05 : let val = self.inner.with(|c| c.get()); | |
: assert!(val != 0, "cannot access a scoped thread local \ | |
: variable without calling `set` first"); | |
: unsafe { | |
8 8.4e-05 : f(&*(val as *const T)) | |
: } | |
: } | |
: | |
: /// Test whether this TLS key has been `set` for the current thread. | |
: pub fn is_set(&'static self) -> bool { | |
: self.inner.with(|c| c.get() != 0) | |
: } | |
:} | |
: | |
:#[cfg(test)] | |
:mod tests { | |
: use std::cell::Cell; | |
: use std::sync::mpsc::{channel, Sender}; | |
: use std::thread; | |
: | |
: scoped_thread_local!(static FOO: u32); | |
: | |
: #[test] | |
: fn smoke() { | |
: scoped_thread_local!(static BAR: u32); | |
: | |
: assert!(!BAR.is_set()); | |
: BAR.set(&1, || { | |
: assert!(BAR.is_set()); | |
: BAR.with(|slot| { | |
: assert_eq!(*slot, 1); | |
: }); | |
: }); | |
: assert!(!BAR.is_set()); | |
: } | |
: | |
: #[test] | |
: fn cell_allowed() { | |
: scoped_thread_local!(static BAR: Cell<u32>); | |
: | |
: BAR.set(&Cell::new(1), || { | |
: BAR.with(|slot| { | |
: assert_eq!(slot.get(), 1); | |
: }); | |
: }); | |
: } | |
: | |
: #[test] | |
: fn scope_item_allowed() { | |
: assert!(!FOO.is_set()); | |
: FOO.set(&1, || { | |
: assert!(FOO.is_set()); | |
: FOO.with(|slot| { | |
: assert_eq!(*slot, 1); | |
: }); | |
: }); | |
: assert!(!FOO.is_set()); | |
: } | |
: | |
: #[test] | |
: fn panic_resets() { | |
: struct Check(Sender<u32>); | |
: impl Drop for Check { | |
: fn drop(&mut self) { | |
: FOO.with(|r| { | |
: self.0.send(*r).unwrap(); | |
: }) | |
: } | |
: } | |
: | |
: let (tx, rx) = channel(); | |
: let t = thread::spawn(|| { | |
: FOO.set(&1, || { | |
: let _r = Check(tx); | |
: | |
: FOO.set(&2, || { | |
: panic!() | |
: }); | |
: }); | |
: }); | |
: | |
: assert_eq!(rx.recv().unwrap(), 1); | |
: assert!(t.join().is_err()); | |
: } | |
:} | |
/* | |
* Total samples for file : "/checkout/src/libstd/sys_common/poison.rs" | |
* | |
* 1308 0.0137 | |
*/ | |
/* std::sys_common::poison::Flag::new::hbf0f8737885dd1cc total: 8 8.4e-05 */ | |
/* | |
* Total samples for file : "SimplifyCFGPass.cpp" | |
* | |
* 1287 0.0135 | |
*/ | |
<credited to line zero> 1287 0.0135 : | |
/* iterativelySimplifyCFG(llvm::Function&, llvm::TargetTransformInfo const&, llvm::AssumptionCache*, unsigned int) total: 467 0.0049 */ | |
/* mergeEmptyReturnBlocks(llvm::Function&) total: 406 0.0043 */ | |
/* (anonymous namespace)::CFGSimplifyPass::runOnFunction(llvm::Function&) total: 414 0.0043 */ | |
/* | |
* Total samples for file : "LoopStrengthReduce.cpp" | |
* | |
* 1262 0.0133 | |
*/ | |
<credited to line zero> 1262 0.0133 : | |
/* llvm::DenseMap<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long, llvm::DenseMapInfo<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > > >, llvm::detail::DenseMapPair<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long> >::grow(unsigned int) total: 4 4.2e-05 */ | |
/* llvm::DenseMap<llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >::grow(unsigned int) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::LSRInstance::Expand((anonymous namespace)::LSRFixup const&, (anonymous namespace)::Formula const&, llvm::ilist_iterator<llvm::Instruction>, llvm::SCEVExpander&, llvm::SmallVectorImpl<llvm::WeakVH>&) const total: 34 3.6e-04 */ | |
/* (anonymous namespace)::LSRInstance::GenerateIVChain((anonymous namespace)::IVChain const&, llvm::SCEVExpander&, llvm::SmallVectorImpl<llvm::WeakVH>&) total: 9 9.4e-05 */ | |
/* llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >::grow(unsigned int) total: 2 2.1e-05 */ | |
/* llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >::grow(unsigned int) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::LSRInstance::RewriteForPHI(llvm::PHINode*, (anonymous namespace)::LSRFixup const&, (anonymous namespace)::Formula const&, llvm::SCEVExpander&, llvm::SmallVectorImpl<llvm::WeakVH>&) const total: 2 2.1e-05 */ | |
/* (anonymous namespace)::LSRInstance::ImplementSolution(llvm::SmallVectorImpl<(anonymous namespace)::Formula const*> const&) total: 6 6.3e-05 */ | |
/* (anonymous namespace)::Cost::isValid() total: 7 7.3e-05 */ | |
/* llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >::setPointerAndInt(llvm::SCEV const*, (anonymous namespace)::LSRUse::KindType) total: 4 4.2e-05 */ | |
/* llvm::SmallVectorImpl<(anonymous namespace)::WorkItem>::~SmallVectorImpl() total: 1 1.0e-05 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long, llvm::DenseMapInfo<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > > >, llvm::detail::DenseMapPair<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long> >, llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long, llvm::DenseMapInfo<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > > >, llvm::detail::DenseMapPair<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long> >::LookupBucketFor<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > > >(llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > > const&, llvm::detail::DenseMapPair<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long> const*&) const total: 5 5.2e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::IVInc, false>::grow(unsigned long) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::IVChain::IVChain((anonymous namespace)::IVInc const&, llvm::SCEV const*) total: 1 1.0e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::IVInc, false>::push_back((anonymous namespace)::IVInc const&) total: 1 1.0e-05 */ | |
/* isAMCompletelyFolded(llvm::TargetTransformInfo const&, (anonymous namespace)::LSRUse::KindType, (anonymous namespace)::MemAccessTy, llvm::GlobalValue*, long, bool, long) [clone .isra.97] total: 48 5.0e-04 */ | |
/* isAMCompletelyFolded(llvm::TargetTransformInfo const&, long, long, (anonymous namespace)::LSRUse::KindType, (anonymous namespace)::MemAccessTy, llvm::GlobalValue*, long, bool, long) [clone .isra.100] total: 17 1.8e-04 */ | |
/* isAMCompletelyFolded(llvm::TargetTransformInfo const&, (anonymous namespace)::LSRUse const&, (anonymous namespace)::Formula const&) total: 1 1.0e-05 */ | |
/* isLegalUse(llvm::TargetTransformInfo const&, long, long, (anonymous namespace)::LSRUse::KindType, (anonymous namespace)::MemAccessTy, llvm::GlobalValue*, long, bool, long) [clone .isra.101] total: 15 1.6e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long, llvm::DenseMapInfo<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > > >, llvm::detail::DenseMapPair<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long> >, llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long, llvm::DenseMapInfo<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > > >, llvm::detail::DenseMapPair<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long> >::initEmpty() total: 1 1.0e-05 */ | |
/* llvm::SmallVectorTemplateCommon<(anonymous namespace)::Formula, void>::back() total: 1 1.0e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >, llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >::initEmpty() total: 1 1.0e-05 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >, llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >::LookupBucketFor<llvm::SCEV const*>(llvm::SCEV const* const&, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> const*&) const total: 20 2.1e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >, llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >::LookupBucketFor<llvm::SCEV const*>(llvm::SCEV const* const&, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData>*&) total: 1 1.0e-05 */ | |
/* llvm::DenseMapIterator<llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData>, false>::DenseMapIterator(llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData>*, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData>*, llvm::DebugEpochBase const&, bool) [clone .constprop.797] total: 1 1.0e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::IVChain, false>::destroy_range((anonymous namespace)::IVChain*, (anonymous namespace)::IVChain*) total: 2 2.1e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::Formula, false>::destroy_range((anonymous namespace)::Formula*, (anonymous namespace)::Formula*) total: 4 4.2e-05 */ | |
/* llvm::SmallVectorImpl<(anonymous namespace)::ChainUsers>::resize(unsigned long) total: 4 4.2e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::LSRFixup, false>::destroy_range((anonymous namespace)::LSRFixup*, (anonymous namespace)::LSRFixup*) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::Formula::canonicalize() [clone .part.613] total: 4 4.2e-05 */ | |
/* findIVOperand(llvm::Use*, llvm::Use*, llvm::Loop*, llvm::ScalarEvolution&) total: 5 5.2e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >, llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >::find(llvm::SCEV const* const&) total: 1 1.0e-05 */ | |
/* llvm::SmallVectorImpl<(anonymous namespace)::Formula const*>::operator=(llvm::SmallVectorImpl<(anonymous namespace)::Formula const*> const&) total: 3 3.1e-05 */ | |
/* getScalingFactorCost(llvm::TargetTransformInfo const&, (anonymous namespace)::LSRUse const&, (anonymous namespace)::Formula const&) total: 15 1.6e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >, llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >::destroyAll() total: 2 2.1e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >, llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >::clear() total: 5 5.2e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long, llvm::DenseMapInfo<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > > >, llvm::detail::DenseMapPair<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long> >, llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long, llvm::DenseMapInfo<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > > >, llvm::detail::DenseMapPair<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long> >::insert(std::pair<llvm::PointerIntPair<llvm::SCEV const*, 2u, (anonymous namespace)::LSRUse::KindType, llvm::PointerLikeTypeTraits<llvm::SCEV const*>, llvm::PointerIntPairInfo<llvm::SCEV const*, 2u, llvm::PointerLikeTypeTraits<llvm::SCEV const*> > >, unsigned long>&&) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::Formula::canonicalize() total: 3 3.1e-05 */ | |
/* llvm::SmallBitVector::find_next(unsigned int) const [clone .part.255] total: 2 2.1e-05 */ | |
/* llvm::SmallBitVector::resize(unsigned int, bool) [clone .constprop.795] total: 2 2.1e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >, llvm::SCEV const*, (anonymous namespace)::RegSortData, llvm::DenseMapInfo<llvm::SCEV const*>, llvm::detail::DenseMapPair<llvm::SCEV const*, (anonymous namespace)::RegSortData> >::insert(std::pair<llvm::SCEV const*, (anonymous namespace)::RegSortData>&&) total: 21 2.2e-04 */ | |
/* (anonymous namespace)::RegUseTracker::dropRegister(llvm::SCEV const*, unsigned long) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::LSRInstance::FinalizeChain((anonymous namespace)::IVChain&) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::Formula::getType() const total: 1 1.0e-05 */ | |
/* llvm::CmpInst::getOperand(unsigned int) const [clone .constprop.806] total: 1 1.0e-05 */ | |
/* (anonymous namespace)::LSRFixup::isUseFullyOutsideLoop(llvm::Loop const*) const [clone .isra.680] total: 2 2.1e-05 */ | |
/* (anonymous namespace)::LSRUse::RecomputeRegs(unsigned long, (anonymous namespace)::RegUseTracker&) total: 20 2.1e-04 */ | |
/* getExprBase(llvm::SCEV const*) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::LoopStrengthReduce::getAnalysisUsage(llvm::AnalysisUsage&) const total: 4 4.2e-05 */ | |
/* (anonymous namespace)::RegUseTracker::countRegister(llvm::SCEV const*, unsigned long) total: 11 1.2e-04 */ | |
/* (anonymous namespace)::LSRInstance::CountRegisters((anonymous namespace)::Formula const&, unsigned long) total: 1 1.0e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >, llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >::destroyAll() [clone .part.524] total: 13 1.4e-04 */ | |
/* (anonymous namespace)::LSRUse::~LSRUse() total: 3 3.1e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::LSRUse, false>::destroy_range((anonymous namespace)::LSRUse*, (anonymous namespace)::LSRUse*) total: 4 4.2e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >, llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >::destroyAll() [clone .part.527] total: 1 1.0e-05 */ | |
/* llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >::~DenseMap() total: 2 2.1e-05 */ | |
/* ExtractImmediate(llvm::SCEV const*&, llvm::ScalarEvolution&) total: 28 2.9e-04 */ | |
/* llvm::ScalarEvolution::getAddExpr(llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV::NoWrapFlags) [clone .constprop.807] total: 2 2.1e-05 */ | |
/* DoInitialMatch(llvm::SCEV const*, llvm::Loop*, llvm::SmallVectorImpl<llvm::SCEV const*>&, llvm::SmallVectorImpl<llvm::SCEV const*>&, llvm::ScalarEvolution&) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::Formula::initialMatch(llvm::SCEV const*, llvm::Loop*, llvm::ScalarEvolution&) total: 2 2.1e-05 */ | |
/* CollectSubexprs(llvm::SCEV const*, llvm::SCEVConstant const*, llvm::SmallVectorImpl<llvm::SCEV const*>&, llvm::Loop const*, llvm::ScalarEvolution&, unsigned int) total: 18 1.9e-04 */ | |
/* getWideOperand(llvm::Value*) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::LSRInstance::~LSRInstance() total: 2 2.1e-05 */ | |
/* ExtractSymbol(llvm::SCEV const*&, llvm::ScalarEvolution&) total: 27 2.8e-04 */ | |
/* getExactSDiv(llvm::SCEV const*, llvm::SCEV const*, llvm::ScalarEvolution&, bool) total: 8 8.4e-05 */ | |
/* (anonymous namespace)::IVChain::isProfitableIncrement(llvm::SCEV const*, llvm::SCEV const*, llvm::ScalarEvolution&) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::LSRInstance::ChainInstruction(llvm::Instruction*, llvm::Instruction*, llvm::SmallVectorImpl<(anonymous namespace)::ChainUsers>&) total: 16 1.7e-04 */ | |
/* (anonymous namespace)::LSRInstance::CollectChains() total: 33 3.5e-04 */ | |
/* (anonymous namespace)::Cost::RateRegister(llvm::SCEV const*, llvm::SmallPtrSetImpl<llvm::SCEV const*>&, llvm::Loop const*, llvm::ScalarEvolution&, llvm::DominatorTree&) total: 23 2.4e-04 */ | |
/* (anonymous namespace)::Cost::RateFormula(llvm::TargetTransformInfo const&, (anonymous namespace)::Formula const&, llvm::SmallPtrSetImpl<llvm::SCEV const*>&, llvm::DenseSet<llvm::SCEV const*, llvm::DenseMapInfo<llvm::SCEV const*> > const&, llvm::Loop const*, llvm::SmallVectorImpl<long> const&, llvm::ScalarEvolution&, llvm::DominatorTree&, (anonymous namespace)::LSRUse const&, llvm::SmallPtrSetImpl<llvm::SCEV const*>*) [clone .constprop.799] total: 16 1.7e-04 */ | |
/* (anonymous namespace)::UniquifierDenseMapInfo::isEqual(llvm::SmallVector<llvm::SCEV const*, 4u> const&, llvm::SmallVector<llvm::SCEV const*, 4u> const&) total: 11 1.2e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >, llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >::LookupBucketFor<llvm::SmallVector<llvm::SCEV const*, 4u> >(llvm::SmallVector<llvm::SCEV const*, 4u> const&, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > const*&) const total: 25 2.6e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >, llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >::LookupBucketFor<llvm::SmallVector<llvm::SCEV const*, 4u> >(llvm::SmallVector<llvm::SCEV const*, 4u> const&, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> >*&) total: 1 1.0e-05 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >, llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >::LookupBucketFor<llvm::SmallVector<llvm::SCEV const*, 4u> >(llvm::SmallVector<llvm::SCEV const*, 4u> const&, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> const*&) const total: 1 1.0e-05 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >, llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >::LookupBucketFor<llvm::SmallVector<llvm::SCEV const*, 4u> >(llvm::SmallVector<llvm::SCEV const*, 4u> const&, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long>*&) total: 1 1.0e-05 */ | |
/* DeleteTriviallyDeadInstructions(llvm::SmallVectorImpl<llvm::WeakVH>&) total: 6 6.3e-05 */ | |
/* (anonymous namespace)::LSRInstance::CollectInterestingTypesAndFactors() total: 15 1.6e-04 */ | |
/* (anonymous namespace)::LSRInstance::NarrowSearchSpaceByPickingWinnerRegs() total: 6 6.3e-05 */ | |
/* (anonymous namespace)::Formula* std::__uninitialized_copy<false>::__uninit_copy<std::move_iterator<(anonymous namespace)::Formula*>, (anonymous namespace)::Formula*>(std::move_iterator<(anonymous namespace)::Formula*>, std::move_iterator<(anonymous namespace)::Formula*>, (anonymous namespace)::Formula*) total: 1 1.0e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::Formula, false>::grow(unsigned long) total: 3 3.1e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >, llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >::initEmpty() total: 1 1.0e-05 */ | |
/* llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >::init(unsigned int) total: 2 2.1e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >, llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseMapPair<llvm::SmallVector<llvm::SCEV const*, 4u>, unsigned long> >::clear() total: 13 1.4e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >, llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >::initEmpty() total: 18 1.9e-04 */ | |
/* (anonymous namespace)::LSRUse::LSRUse((anonymous namespace)::LSRUse::KindType, (anonymous namespace)::MemAccessTy) total: 3 3.1e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >, llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >::insert(std::pair<llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty>&&) total: 18 1.9e-04 */ | |
/* llvm::DenseMap<llvm::SmallVector<llvm::SCEV const*, 4u>, llvm::detail::DenseSetEmpty, (anonymous namespace)::UniquifierDenseMapInfo, llvm::detail::DenseSetPair<llvm::SmallVector<llvm::SCEV const*, 4u> > >::init(unsigned int) [clone .constprop.793] total: 1 1.0e-05 */ | |
/* llvm::DenseSet<llvm::SmallVector<llvm::SCEV const*, 4u>, (anonymous namespace)::UniquifierDenseMapInfo>::insert(llvm::SmallVector<llvm::SCEV const*, 4u> const&) total: 14 1.5e-04 */ | |
/* (anonymous namespace)::Formula::Formula((anonymous namespace)::Formula const&) total: 17 1.8e-04 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::Formula, false>::push_back((anonymous namespace)::Formula const&) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::LSRUse::InsertFormula((anonymous namespace)::Formula const&) total: 35 3.7e-04 */ | |
/* (anonymous namespace)::LSRInstance::InsertFormula((anonymous namespace)::LSRUse&, unsigned int, (anonymous namespace)::Formula const&) total: 11 1.2e-04 */ | |
/* (anonymous namespace)::LSRInstance::InsertInitialFormula(llvm::SCEV const*, (anonymous namespace)::LSRUse&, unsigned long) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::LSRInstance::GenerateReassociationsImpl((anonymous namespace)::LSRUse&, unsigned int, (anonymous namespace)::Formula const&, unsigned int, unsigned long, bool) total: 50 5.2e-04 */ | |
/* (anonymous namespace)::LSRInstance::GenerateReassociations((anonymous namespace)::LSRUse&, unsigned int, (anonymous namespace)::Formula, unsigned int) total: 2 2.1e-05 */ | |
/* (anonymous namespace)::LSRInstance::GenerateSymbolicOffsetsImpl((anonymous namespace)::LSRUse&, unsigned int, (anonymous namespace)::Formula const&, unsigned long, bool) total: 5 5.2e-05 */ | |
/* (anonymous namespace)::LSRInstance::GenerateConstantOffsetsImpl((anonymous namespace)::LSRUse&, unsigned int, (anonymous namespace)::Formula const&, llvm::SmallVectorImpl<long> const&, unsigned long, bool) total: 15 1.6e-04 */ | |
/* (anonymous namespace)::LSRInstance::NarrowSearchSpaceByDetectingSupersets() total: 2 2.1e-05 */ | |
/* (anonymous namespace)::LSRInstance::FilterOutUndesirableDedicatedRegisters() total: 112 0.0012 */ | |
/* (anonymous namespace)::LSRInstance::NarrowSearchSpaceByRefilteringUndesirableDedicatedRegisters() total: 2 2.1e-05 */ | |
/* (anonymous namespace)::LSRInstance::OptimizeLoopTermCond() total: 5 5.2e-05 */ | |
/* (anonymous namespace)::LSRUse::LSRUse((anonymous namespace)::LSRUse&&) total: 1 1.0e-05 */ | |
/* llvm::SmallVectorTemplateBase<(anonymous namespace)::LSRUse, false>::push_back((anonymous namespace)::LSRUse&&) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::LSRInstance::getUse(llvm::SCEV const*&, (anonymous namespace)::LSRUse::KindType, (anonymous namespace)::MemAccessTy) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::LSRInstance::CollectLoopInvariantFixupsAndFormulae() total: 13 1.4e-04 */ | |
/* (anonymous namespace)::LSRInstance::CollectFixupsAndInitialFormulae() total: 15 1.6e-04 */ | |
/* (anonymous namespace)::LSRInstance::NarrowSearchSpaceByCollapsingUnrolledCode() total: 3 3.1e-05 */ | |
/* (anonymous namespace)::LSRInstance::NarrowSearchSpaceUsingHeuristics() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::LSRInstance::GenerateCrossUseConstantOffsets() total: 71 7.5e-04 */ | |
/* (anonymous namespace)::LSRInstance::GenerateAllReuseFormulae() total: 150 0.0016 */ | |
/* (anonymous namespace)::LSRInstance::SolveRecurse(llvm::SmallVectorImpl<(anonymous namespace)::Formula const*>&, (anonymous namespace)::Cost&, llvm::SmallVectorImpl<(anonymous namespace)::Formula const*>&, (anonymous namespace)::Cost const&, llvm::SmallPtrSet<llvm::SCEV const*, 16u> const&, llvm::DenseSet<llvm::SCEV const*, llvm::DenseMapInfo<llvm::SCEV const*> >&) const total: 41 4.3e-04 */ | |
/* (anonymous namespace)::LSRInstance::Solve(llvm::SmallVectorImpl<(anonymous namespace)::Formula const*>&) const total: 4 4.2e-05 */ | |
/* (anonymous namespace)::LSRInstance::LSRInstance(llvm::Loop*, llvm::IVUsers&, llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&, llvm::TargetTransformInfo const&) total: 21 2.2e-04 */ | |
/* (anonymous namespace)::LoopStrengthReduce::runOnLoop(llvm::Loop*, llvm::LPPassManager&) [clone .part.769] total: 7 7.3e-05 */ | |
/* | |
* Total samples for file : "/home/stb/data-rs/http-server/<try_ready macros>" | |
* | |
* 1232 0.0129 | |
*/ | |
/* | |
* Total samples for file : "regex.cgu-0.rs" | |
* | |
* 1205 0.0127 | |
*/ | |
<credited to line zero> 1205 0.0127 : | |
/* _$LT$collections..vec..Vec$LT$T$GT$$GT$::reserve::hff1313bc5608f03e total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::get::hec64ca0963b1ef29 total: 1 1.0e-05 */ | |
/* _$LT$core..iter..Map$LT$I$C$$u20$F$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::hea391dea2ab2901a total: 6 6.3e-05 */ | |
/* regex::compile::Compiler::c::h9d42986b8ba2b158 total: 1 1.0e-05 */ | |
/* regex::compile::Compiler::c_class::h65486a83401a377f total: 1 1.0e-05 */ | |
/* regex::compile::Compiler::fill::h7dd08a144d2a53ef total: 6 6.3e-05 */ | |
/* regex::compile::CompileClass::c_utf8_seq::hd4d51bf024beb877 total: 7 7.3e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::get::hec64ca0963b1ef29 total: 5 5.2e-05 */ | |
/* _$LT$core..iter..Map$LT$I$C$$u20$F$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::hea391dea2ab2901a total: 265 0.0028 */ | |
/* regex::compile::Compiler::c::h9d42986b8ba2b158 total: 31 3.3e-04 */ | |
/* regex::compile::Compiler::c_class::h65486a83401a377f total: 154 0.0016 */ | |
/* regex::compile::Compiler::fill::h7dd08a144d2a53ef total: 84 8.8e-04 */ | |
/* regex::compile::CompileClass::c_utf8_seq::hd4d51bf024beb877 total: 397 0.0042 */ | |
/* _$LT$std..collections..hash..map..DefaultHasher$u20$as$u20$core..hash..Hasher$GT$::write::ha79ab5ed4774528c total: 10 1.0e-04 */ | |
/* _$LT$std..collections..hash..map..DefaultHasher$u20$as$u20$core..hash..Hasher$GT$::finish::h49a332bc8ea6cf6a total: 9 9.4e-05 */ | |
/* _$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$::double::h06f32d01d77fcc35 total: 2 2.1e-05 */ | |
/* _$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$::double::h2f4b2386ecff19f3 total: 1 1.0e-05 */ | |
/* _$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$::double::h9962e9dbb13afce4 total: 4 4.2e-05 */ | |
/* _$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$::double::ha30c1cf686928678 total: 2 2.1e-05 */ | |
/* _$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$::double::he5a5fa03f10567aa total: 2 2.1e-05 */ | |
/* drop::h8401938fb6bf484a total: 2 2.1e-05 */ | |
/* drop::hb51bf255061b788c total: 4 4.2e-05 */ | |
/* drop::hfe108283fed2ae5d total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..table..RawTable$LT$K$C$$u20$V$GT$$GT$::new::hc05ef17844192bdf total: 2 2.1e-05 */ | |
/* _$LT$core..iter..Rev$LT$I$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::hcf1798c0596c8afe total: 1 1.0e-05 */ | |
/* _$LT$core..slice..Iter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::haa19de42cf115460 total: 4 4.2e-05 */ | |
/* _$LT$regex..backtrack..Bounded$LT$$u27$a$C$$u20$$u27$m$C$$u20$$u27$r$C$$u20$$u27$s$C$$u20$I$GT$$GT$::backtrack::h399366b38164ee43 total: 8 8.4e-05 */ | |
/* regex::utf8::decode_last_utf8::hfe7cc141ec9e699c total: 1 1.0e-05 */ | |
/* regex::compile::Compiler::compile_finish::hf3c76876b52d8179 total: 46 4.8e-04 */ | |
/* regex::compile::Compiler::c_capture::h743031ba8005a029 total: 1 1.0e-05 */ | |
/* regex::compile::Compiler::c_char::h2309ffe76b350783 total: 6 6.3e-05 */ | |
/* regex::compile::Compiler::c_concat::h053a58512bd24449 total: 2 2.1e-05 */ | |
/* regex::compile::Compiler::c_concat::h08ca3938cce51142 total: 2 2.1e-05 */ | |
/* regex::compile::Compiler::c_alternate::h95865801c8421e99 total: 7 7.3e-05 */ | |
/* regex::compile::Compiler::c_repeat::h2c017bf06385ce8c total: 2 2.1e-05 */ | |
/* regex::compile::Compiler::c_repeat_zero_or_more::h6f5cc92f6e9131f5 total: 1 1.0e-05 */ | |
/* regex::compile::Compiler::fill_split::hf770d85bb355f00d total: 26 2.7e-04 */ | |
/* regex::dfa::Cache::new::ha620399a4c497f63 total: 2 2.1e-05 */ | |
/* regex::dfa::Fsm::add_state::hb8b3a3ca22f4de96 total: 43 4.5e-04 */ | |
/* regex::exec::ExecNoSync::captures_nfa_with_match::h4d69d49829c96679 total: 3 3.1e-05 */ | |
/* regex::exec::ExecNoSync::exec_nfa::h8678bd7bb05758c5 total: 4 4.2e-05 */ | |
/* regex::literals::LiteralSearcher::new::hd4668b4094b3b072 total: 5 5.2e-05 */ | |
/* regex::literals::Matcher::new::h96ffcbb0c2b64a6f total: 1 1.0e-05 */ | |
/* regex::literals::SingleSearch::new::h9080c1a04ce46d47 total: 4 4.2e-05 */ | |
/* _$LT$std..collections..hash..map..DefaultHasher$u20$as$u20$core..hash..Hasher$GT$::write::hfd71973413218d3b total: 1 1.0e-05 */ | |
/* _$LT$regex..backtrack..Bounded$LT$$u27$a$C$$u20$$u27$m$C$$u20$$u27$r$C$$u20$$u27$s$C$$u20$I$GT$$GT$::backtrack::h9d7beb368ff61a9b total: 1 1.0e-05 */ | |
/* regex::compile::Compiler::compile_finish::hfe406a26824f2b5a total: 5 5.2e-05 */ | |
/* regex::compile::Compiler::c::h58beaabc8a62f9cc total: 1 1.0e-05 */ | |
/* regex::compile::Compiler::c_class::ha80bcb7cc50c4946 total: 3 3.1e-05 */ | |
/* regex::compile::Compiler::c_repeat_zero_or_more::hf570edbb720f4b20 total: 1 1.0e-05 */ | |
/* regex::compile::Compiler::fill::hbc17e589ea5d03a7 total: 6 6.3e-05 */ | |
/* regex::compile::CompileClass::c_utf8_seq::h2f3e7eb60c8f8154 total: 9 9.4e-05 */ | |
/* regex::dfa::Fsm::add_state::h40135b50ddef85fc total: 1 1.0e-05 */ | |
/* regex::literals::Matcher::new::h2d2a48456d8737db total: 10 1.0e-04 */ | |
/* | |
* Total samples for file : "Local.cpp" | |
* | |
* 1204 0.0126 | |
*/ | |
<credited to line zero> 1204 0.0126 : | |
/* llvm::DenseMap<llvm::PHINode*, llvm::detail::DenseSetEmpty, llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo, llvm::detail::DenseSetPair<llvm::PHINode*> >::grow(unsigned int) total: 115 0.0012 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::PHINode*, llvm::detail::DenseSetEmpty, llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo, llvm::detail::DenseSetPair<llvm::PHINode*> >, llvm::PHINode*, llvm::detail::DenseSetEmpty, llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo, llvm::detail::DenseSetPair<llvm::PHINode*> >::initEmpty() total: 277 0.0029 */ | |
/* llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo::isEqual(llvm::PHINode*, llvm::PHINode*) [clone .constprop.630] total: 3 3.1e-05 */ | |
/* llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo::isEqual(llvm::PHINode*, llvm::PHINode*) total: 17 1.8e-04 */ | |
/* llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo::isEqual(llvm::PHINode*, llvm::PHINode*) [clone .constprop.629] total: 23 2.4e-04 */ | |
/* llvm::Optional<BitPart>::reset() [clone .part.202] total: 2 2.1e-05 */ | |
/* CanMergeValues(llvm::Value*, llvm::Value*) total: 3 3.1e-05 */ | |
/* llvm::SwitchInst::CaseIteratorT<llvm::SwitchInst, llvm::ConstantInt, llvm::BasicBlock>::getCaseSuccessor() [clone .isra.501] total: 2 2.1e-05 */ | |
/* llvm::CallInst::getArgOperand(unsigned int) const [clone .constprop.636] total: 126 0.0013 */ | |
/* LdStHasDebugValue(llvm::DILocalVariable*, llvm::DIExpression*, llvm::Instruction*) total: 52 5.5e-04 */ | |
/* llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo::getHashValue(llvm::PHINode*) total: 156 0.0016 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::PHINode*, llvm::detail::DenseSetEmpty, llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo, llvm::detail::DenseSetPair<llvm::PHINode*> >, llvm::PHINode*, llvm::detail::DenseSetEmpty, llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo, llvm::detail::DenseSetPair<llvm::PHINode*> >::LookupBucketFor<llvm::PHINode*>(llvm::PHINode* const&, llvm::detail::DenseSetPair<llvm::PHINode*> const*&) const total: 88 9.2e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::PHINode*, llvm::detail::DenseSetEmpty, llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo, llvm::detail::DenseSetPair<llvm::PHINode*> >, llvm::PHINode*, llvm::detail::DenseSetEmpty, llvm::EliminateDuplicatePHINodes(llvm::BasicBlock*)::PHIDenseMapInfo, llvm::detail::DenseSetPair<llvm::PHINode*> >::LookupBucketFor<llvm::PHINode*>(llvm::PHINode* const&, llvm::detail::DenseSetPair<llvm::PHINode*>*&) total: 20 2.1e-04 */ | |
/* simplifyAndDCEInstruction(llvm::Instruction*, llvm::SmallSetVector<llvm::Instruction*, 16u>&, llvm::DataLayout const&, llvm::TargetLibraryInfo const*) total: 20 2.1e-04 */ | |
/* selectIncomingValueForBlock(llvm::Value*, llvm::BasicBlock*, llvm::DenseMap<llvm::BasicBlock*, llvm::Value*, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, llvm::Value*> >&) total: 18 1.9e-04 */ | |
/* collectBitParts(llvm::Value*, bool, bool, std::map<llvm::Value*, llvm::Optional<BitPart>, std::less<llvm::Value*>, std::allocator<std::pair<llvm::Value* const, llvm::Optional<BitPart> > > >&) total: 247 0.0026 */ | |
/* changeToCall(llvm::InvokeInst*) total: 35 3.7e-04 */ | |
/* | |
* Total samples for file : "X86MCCodeEmitter.cpp" | |
* | |
* 1136 0.0119 | |
*/ | |
<credited to line zero> 1136 0.0119 : | |
/* (anonymous namespace)::X86MCCodeEmitter::~X86MCCodeEmitter() total: 2 2.1e-05 */ | |
/* getImmFixupKind(unsigned long) total: 72 7.6e-04 */ | |
/* (anonymous namespace)::X86MCCodeEmitter::EmitSegmentOverridePrefix(unsigned int&, unsigned int, llvm::MCInst const&, llvm::raw_ostream&) const [clone .isra.37] total: 20 2.1e-04 */ | |
/* (anonymous namespace)::X86MCCodeEmitter::EmitImmediate(llvm::MCOperand const&, llvm::SMLoc, unsigned int, llvm::MCFixupKind, unsigned int&, llvm::raw_ostream&, llvm::SmallVectorImpl<llvm::MCFixup>&, int) const [clone .isra.52] total: 82 8.6e-04 */ | |
/* (anonymous namespace)::X86MCCodeEmitter::emitMemModRMByte(llvm::MCInst const&, unsigned int, unsigned int, unsigned long, bool, unsigned int&, llvm::raw_ostream&, llvm::SmallVectorImpl<llvm::MCFixup>&, llvm::MCSubtargetInfo const&) const total: 112 0.0012 */ | |
/* (anonymous namespace)::X86MCCodeEmitter::encodeInstruction(llvm::MCInst const&, llvm::raw_ostream&, llvm::SmallVectorImpl<llvm::MCFixup>&, llvm::MCSubtargetInfo const&) const total: 848 0.0089 */ | |
/* | |
* Total samples for file : "DeadStoreElimination.cpp" | |
* | |
* 1130 0.0119 | |
*/ | |
<credited to line zero> 1130 0.0119 : | |
/* llvm::CallInst::getArgOperand(unsigned int) const [clone .constprop.342] total: 4 4.2e-05 */ | |
/* getLocForWrite(llvm::Instruction*, llvm::AAResults&) [clone .isra.273] total: 30 3.1e-04 */ | |
/* bool llvm::SetVector<llvm::Value*, llvm::SmallVector<llvm::Value*, 16u>, llvm::SmallSet<llvm::Value*, 16u, std::less<llvm::Value*> > >::TestAndEraseFromSet<handleEndBlock(llvm::BasicBlock&, llvm::AAResults*, llvm::MemoryDependenceResults*, llvm::TargetLibraryInfo const*)::{lambda(llvm::Value*)#1}>::operator()<llvm::Value*>(llvm::Value* const&) total: 7 7.3e-05 */ | |
/* hasMemoryWrite(llvm::Instruction*, llvm::TargetLibraryInfo const&) total: 245 0.0026 */ | |
/* deleteDeadInstruction(llvm::Instruction*, llvm::ilist_iterator<llvm::Instruction>*, llvm::MemoryDependenceResults&, llvm::TargetLibraryInfo const&, llvm::SmallSetVector<llvm::Value*, 16u>*) [clone .constprop.340] total: 1 1.0e-05 */ | |
/* isRemovable(llvm::Instruction*) [clone .part.275] total: 5 5.2e-05 */ | |
/* isRemovable(llvm::Instruction*) total: 12 1.3e-04 */ | |
/* handleEndBlock(llvm::BasicBlock&, llvm::AAResults*, llvm::MemoryDependenceResults*, llvm::TargetLibraryInfo const*) total: 363 0.0038 */ | |
/* eliminateDeadStores(llvm::Function&, llvm::AAResults*, llvm::MemoryDependenceResults*, llvm::DominatorTree*, llvm::TargetLibraryInfo const*) total: 419 0.0044 */ | |
/* (anonymous namespace)::DSELegacyPass::runOnFunction(llvm::Function&) total: 44 4.6e-04 */ | |
/* | |
* Total samples for file : "/checkout/src/liballoc/boxed.rs" | |
* | |
* 1110 0.0117 | |
*/ | |
/* _$LT$alloc..boxed..Box$LT$str$GT$$u20$as$u20$core..clone..Clone$GT$::clone::h85dae0a9c45c064f total: 125 0.0013 */ | |
/* _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hb66f35ccaf7f73c5 total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "ELFObjectWriter.cpp" | |
* | |
* 1095 0.0115 | |
*/ | |
<credited to line zero> 1095 0.0115 : | |
/* void std::vector<(anonymous namespace)::ELFObjectWriter::ELFSymbolData, std::allocator<(anonymous namespace)::ELFObjectWriter::ELFSymbolData> >::_M_emplace_back_aux<(anonymous namespace)::ELFObjectWriter::ELFSymbolData const&>((anonymous namespace)::ELFObjectWriter::ELFSymbolData const&) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::ELFObjectWriter::~ELFObjectWriter() total: 3 3.1e-05 */ | |
/* (anonymous namespace)::ELFObjectWriter::WriteSecHdrEntry(unsigned int, unsigned int, unsigned long, unsigned long, unsigned long, unsigned long, unsigned int, unsigned int, unsigned long, unsigned long) [clone .constprop.322] total: 14 1.5e-04 */ | |
/* (anonymous namespace)::ELFObjectWriter::writeSectionHeader(llvm::MCAsmLayout const&, llvm::DenseMap<llvm::MCSectionELF const*, unsigned int, llvm::DenseMapInfo<llvm::MCSectionELF const*>, llvm::detail::DenseMapPair<llvm::MCSectionELF const*, unsigned int> > const&, std::map<llvm::MCSectionELF const*, std::pair<unsigned long, unsigned long>, std::less<llvm::MCSectionELF const*>, std::allocator<std::pair<llvm::MCSectionELF const* const, std::pair<unsigned long, unsigned long> > > > const&) total: 38 4.0e-04 */ | |
/* int llvm::array_pod_sort_comparator<(anonymous namespace)::ELFObjectWriter::ELFSymbolData>(void const*, void const*) total: 41 4.3e-04 */ | |
/* (anonymous namespace)::ELFObjectWriter::writeHeader(llvm::MCAssembler const&) total: 3 3.1e-05 */ | |
/* (anonymous namespace)::ELFObjectWriter::reset() total: 3 3.1e-05 */ | |
/* (anonymous namespace)::ELFObjectWriter::writeSymbol((anonymous namespace)::SymbolTableWriter&, unsigned int, (anonymous namespace)::ELFObjectWriter::ELFSymbolData&, llvm::MCAsmLayout const&) [clone .isra.317] total: 23 2.4e-04 */ | |
/* (anonymous namespace)::SymbolTableWriter::writeSymbol(unsigned int, unsigned char, unsigned long, unsigned long, unsigned char, unsigned int, bool) [clone .constprop.325] total: 1 1.0e-05 */ | |
/* (anonymous namespace)::ELFObjectWriter::computeSymbolTable(llvm::MCAssembler&, llvm::MCAsmLayout const&, llvm::DenseMap<llvm::MCSectionELF const*, unsigned int, llvm::DenseMapInfo<llvm::MCSectionELF const*>, llvm::detail::DenseMapPair<llvm::MCSectionELF const*, unsigned int> > const&, llvm::DenseMap<llvm::MCSymbol const*, unsigned int, llvm::DenseMapInfo<llvm::MCSymbol const*>, llvm::detail::DenseMapPair<llvm::MCSymbol const*, unsigned int> > const&, std::map<llvm::MCSectionELF const*, std::pair<unsigned long, unsigned long>, std::less<llvm::MCSectionELF const*>, std::allocator<std::pair<llvm::MCSectionELF const* const, std::pair<unsigned long, unsigned long> > > >&) total: 118 0.0012 */ | |
/* (anonymous namespace)::ELFObjectWriter::executePostLayoutBinding(llvm::MCAssembler&, llvm::MCAsmLayout const&) total: 37 3.9e-04 */ | |
/* (anonymous namespace)::ELFObjectWriter::recordRelocation(llvm::MCAssembler&, llvm::MCAsmLayout const&, llvm::MCFragment const*, llvm::MCFixup const&, llvm::MCValue, bool&, unsigned long&) total: 468 0.0049 */ | |
/* (anonymous namespace)::ELFObjectWriter::writeObject(llvm::MCAssembler&, llvm::MCAsmLayout const&) total: 316 0.0033 */ | |
/* (anonymous namespace)::ELFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(llvm::MCAssembler const&, llvm::MCSymbol const&, llvm::MCFragment const&, bool, bool) const total: 27 2.8e-04 */ | |
/* | |
* Total samples for file : "MachineSink.cpp" | |
* | |
* 1080 0.0113 | |
*/ | |
<credited to line zero> 1080 0.0113 : | |
/* void std::__insertion_sort<llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}>(llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}) total: 37 3.9e-04 */ | |
/* void std::__merge_sort_with_buffer<llvm::MachineBasicBlock**, llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}>(llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}, llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}) total: 10 1.0e-04 */ | |
/* llvm::Pass* llvm::callDefaultCtor<(anonymous namespace)::MachineSinking>() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::MachineSinking::AllUsesDominatedByBlock(unsigned int, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, bool&, bool&) const [clone .isra.146] total: 234 0.0025 */ | |
/* (anonymous namespace)::MachineSinking::releaseMemory() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::MachineSinking::~MachineSinking() total: 1 1.0e-05 */ | |
/* void std::__merge_adaptive<llvm::MachineBasicBlock**, long, llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}>(llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}, long, llvm::MachineBasicBlock**, llvm::MachineBasicBlock**, llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}) total: 34 3.6e-04 */ | |
/* void std::__inplace_stable_sort<llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}>(llvm::MachineBasicBlock**, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}, (anonymous namespace)::MachineSinking::GetAllSortedSuccessors(llvm::MachineInstr&, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) const::{lambda(llvm::MachineBasicBlock const*, llvm::MachineBasicBlock const*)#1}) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::MachineSinking::FindSuccToSinkTo(llvm::MachineInstr&, llvm::MachineBasicBlock*, bool&, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) total: 218 0.0023 */ | |
/* (anonymous namespace)::MachineSinking::isProfitableToSinkTo(unsigned int, llvm::MachineInstr&, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) total: 22 2.3e-04 */ | |
/* (anonymous namespace)::MachineSinking::PostponeSplitCriticalEdge(llvm::MachineInstr&, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, bool) total: 16 1.7e-04 */ | |
/* (anonymous namespace)::MachineSinking::runOnMachineFunction(llvm::MachineFunction&) [clone .part.300] total: 503 0.0053 */ | |
/* (anonymous namespace)::MachineSinking::runOnMachineFunction(llvm::MachineFunction&) total: 2 2.1e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/thread/mod.rs" | |
* | |
* 1073 0.0113 | |
*/ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/stdlib/msort.c" | |
* | |
* 1045 0.0110 | |
*/ | |
/* msort_with_tmp.part.0 total: 832 0.0087 */ | |
/* qsort_r total: 142 0.0015 */ | |
/* qsort total: 71 7.5e-04 */ | |
/* | |
* Total samples for file : "PruneEH.cpp" | |
* | |
* 1042 0.0109 | |
*/ | |
<credited to line zero> 1042 0.0109 : | |
/* (anonymous namespace)::PruneEH::~PruneEH() total: 1 1.0e-05 */ | |
/* DeleteBasicBlock(llvm::BasicBlock*, llvm::CallGraph&) total: 23 2.4e-04 */ | |
/* SimplifyFunction(llvm::Function*, llvm::CallGraph&) total: 702 0.0074 */ | |
/* (anonymous namespace)::PruneEH::runOnSCC(llvm::CallGraphSCC&) total: 316 0.0033 */ | |
/* | |
* Total samples for file : "TwoAddressInstructionPass.cpp" | |
* | |
* 998 0.0105 | |
*/ | |
<credited to line zero> 998 0.0105 : | |
/* getMappedReg(unsigned int, llvm::DenseMap<unsigned int, unsigned int, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, unsigned int> >&) total: 6 6.3e-05 */ | |
/* isTwoAddrUse(llvm::MachineInstr&, unsigned int, unsigned int&) total: 12 1.3e-04 */ | |
/* isCopyToReg(llvm::MachineInstr&, llvm::TargetInstrInfo const*, unsigned int&, unsigned int&, bool&, bool&) [clone .isra.72] total: 41 4.3e-04 */ | |
/* void std::__advance<llvm::MachineInstrBundleIterator<llvm::MachineInstr>, long>(llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, long, std::bidirectional_iterator_tag) [clone .isra.196] total: 1 1.0e-05 */ | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<unsigned int, llvm::SmallVector<std::pair<unsigned int, unsigned int>, 4u>, 4u, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, llvm::SmallVector<std::pair<unsigned int, unsigned int>, 4u> > >, unsigned int, llvm::SmallVector<std::pair<unsigned int, unsigned int>, 4u>, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, llvm::SmallVector<std::pair<unsigned int, unsigned int>, 4u> > >::destroyAll() [clone .part.331] total: 6 6.3e-05 */ | |
/* regOverlapsSet(llvm::SmallVectorImpl<unsigned int> const&, unsigned int, llvm::TargetRegisterInfo const*) total: 6 6.3e-05 */ | |
/* llvm::MachineInstrBundleIterator<llvm::MachineInstr> std::next<llvm::MachineInstrBundleIterator<llvm::MachineInstr> >(llvm::MachineInstrBundleIterator<llvm::MachineInstr>, std::iterator_traits<llvm::MachineInstrBundleIterator<llvm::MachineInstr> >::difference_type) [clone .constprop.395] total: 1 1.0e-05 */ | |
/* (anonymous namespace)::TwoAddressInstructionPass::noUseAfterLastDef(unsigned int, unsigned int, unsigned int&) total: 14 1.5e-04 */ | |
/* (anonymous namespace)::TwoAddressInstructionPass::isRevCopyChain(unsigned int, unsigned int, int) [clone .isra.231] [clone .constprop.376] total: 4 4.2e-05 */ | |
/* (anonymous namespace)::TwoAddressInstructionPass::isDefTooClose(unsigned int, unsigned int, llvm::MachineInstr*) total: 1 1.0e-05 */ | |
/* llvm::Pass* llvm::callDefaultCtor<(anonymous namespace)::TwoAddressInstructionPass>() total: 1 1.0e-05 */ | |
/* isPlainlyKilled(llvm::MachineInstr*, unsigned int, llvm::LiveIntervals*) total: 1 1.0e-05 */ | |
/* isKilled(llvm::MachineInstr&, unsigned int, llvm::MachineRegisterInfo const*, llvm::TargetInstrInfo const*, llvm::LiveIntervals*, bool) [clone .isra.355] total: 17 1.8e-04 */ | |
/* (anonymous namespace)::TwoAddressInstructionPass::sink3AddrInstruction(llvm::MachineInstr*, unsigned int, llvm::MachineInstrBundleIterator<llvm::MachineInstr>) total: 15 1.6e-04 */ | |
/* (anonymous namespace)::TwoAddressInstructionPass::processTiedPairs(llvm::MachineInstr*, llvm::SmallVector<std::pair<unsigned int, unsigned int>, 4u>&, unsigned int&) total: 93 9.8e-04 */ | |
/* (anonymous namespace)::TwoAddressInstructionPass::scanUses(unsigned int) total: 40 4.2e-04 */ | |
/* (anonymous namespace)::TwoAddressInstructionPass::tryInstructionTransform(llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, llvm::MachineInstrBundleIterator<llvm::MachineInstr>&, unsigned int, unsigned int, unsigned int, bool) total: 69 7.2e-04 */ | |
/* (anonymous namespace)::TwoAddressInstructionPass::runOnMachineFunction(llvm::MachineFunction&) total: 668 0.0070 */ | |
/* (anonymous namespace)::TwoAddressInstructionPass::getAnalysisUsage(llvm::AnalysisUsage&) const total: 2 2.1e-05 */ | |
/* | |
* Total samples for file : "SelectionDAGISel.cpp" | |
* | |
* 989 0.0104 | |
*/ | |
<credited to line zero> 989 0.0104 : | |
/* __gnu_cxx::__exchange_and_add_dispatch(int*, int) [clone .constprop.939] total: 78 8.2e-04 */ | |
/* (anonymous namespace)::ISelUpdater::NodeDeleted(llvm::SDNode*, llvm::SDNode*) total: 54 5.7e-04 */ | |
/* std::_Function_base::_Base_manager<llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int)::{lambda(llvm::SDNode*, llvm::SDNode*)#1}>::_M_manager(std::_Any_data&, std::_Function_base::_Base_manager<llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int)::{lambda(llvm::SDNode*, llvm::SDNode*)#1}> const&, std::_Manager_operation) total: 109 0.0011 */ | |
/* (anonymous namespace)::MatchStateUpdater::~MatchStateUpdater() total: 22 2.3e-04 */ | |
/* findNonImmUse(llvm::SDNode*, llvm::SDNode*, llvm::SDNode*, llvm::SDNode*, llvm::SmallPtrSetImpl<llvm::SDNode*>&, bool) total: 15 1.6e-04 */ | |
/* std::_Function_handler<void (llvm::SDNode*, llvm::SDNode*), llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int)::{lambda(llvm::SDNode*, llvm::SDNode*)#1}>::_M_invoke(std::_Any_data const&, llvm::SDNode*, llvm::SDNode*) total: 85 8.9e-04 */ | |
/* setupSwiftErrorVals(llvm::Function const&, llvm::TargetLowering const*, llvm::FunctionLoweringInfo*) total: 115 0.0012 */ | |
/* WalkChainUsers(llvm::SDNode const*, llvm::SmallVectorImpl<llvm::SDNode*>&, llvm::DenseMap<llvm::SDNode const*, ChainResult, llvm::DenseMapInfo<llvm::SDNode const*>, llvm::detail::DenseMapPair<llvm::SDNode const*, ChainResult> >&, llvm::SmallVectorImpl<llvm::SDNode*>&) total: 181 0.0019 */ | |
/* HandleMergeInputChains(llvm::SmallVectorImpl<llvm::SDNode*>&, llvm::SelectionDAG*) total: 265 0.0028 */ | |
/* mergeIncomingSwiftErrors(llvm::FunctionLoweringInfo*, llvm::TargetLowering const*, llvm::TargetInstrInfo const*, llvm::BasicBlock const*, llvm::SelectionDAGBuilder*) total: 65 6.8e-04 */ | |
/* | |
* Total samples for file : "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.10/src/future/map.rs" | |
* | |
* 974 0.0102 | |
*/ | |
:use {Future, Poll, Async}; | |
: | |
:/// Future for the `map` combinator, changing the type of a future. | |
:/// | |
:/// This is created by the `Future::map` method. | |
:#[must_use = "futures do nothing unless polled"] | |
:pub struct Map<A, F> where A: Future { | |
: future: A, | |
: f: Option<F>, | |
:} | |
: | |
:pub fn new<A, F>(future: A, f: F) -> Map<A, F> | |
: where A: Future, | |
:{ | |
: Map { | |
: future: future, | |
: f: Some(f), | |
: } | |
:} | |
: | |
:impl<U, A, F> Future for Map<A, F> | |
: where A: Future, | |
: F: FnOnce(A::Item) -> U, | |
:{ | |
: type Item = U; | |
: type Error = A::Error; | |
: | |
: fn poll(&mut self) -> Poll<U, A::Error> { | |
: let e = match self.future.poll() { | |
959 0.0101 : Ok(Async::NotReady) => return Ok(Async::NotReady), | |
11 1.2e-04 : Ok(Async::Ready(e)) => Ok(e), | |
: Err(e) => Err(e), | |
: }; | |
4 4.2e-05 : e.map(self.f.take().expect("cannot poll Map twice")) | |
: .map(Async::Ready) | |
: } | |
:} | |
/* | |
* Total samples for file : "X86TargetMachine.cpp" | |
* | |
* 972 0.0102 | |
*/ | |
<credited to line zero> 972 0.0102 : | |
/* __gnu_cxx::__exchange_and_add_dispatch(int*, int) [clone .constprop.391] total: 1 1.0e-05 */ | |
/* (anonymous namespace)::X86PassConfig::addILPOpts() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::X86PassConfig::~X86PassConfig() total: 1 1.0e-05 */ | |
/* llvm::TargetTransformInfoImplBase::isLoweredToCall(llvm::Function const*) [clone .part.96] total: 461 0.0048 */ | |
/* std::_Function_handler<llvm::TargetTransformInfo (llvm::Function const&), llvm::X86TargetMachine::getTargetIRAnalysis()::{lambda(llvm::Function const&)#1}>::_M_invoke(std::_Any_data const&, llvm::Function const&) total: 508 0.0053 */ | |
/* | |
* Total samples for file : "/checkout/src/liballoc/raw_vec.rs" | |
* | |
* 955 0.0100 | |
*/ | |
/* _$LT$std..path..PathBuf$u20$as$u20$core..cmp..PartialEq$GT$::eq::h957cb9b6403f41af total: 1 1.0e-05 */ | |
/* _$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$::double::hc8abf4e80b606296 total: 10 1.0e-04 */ | |
/* | |
* Total samples for file : "tree.cc" | |
* | |
* 941 0.0099 | |
*/ | |
<credited to line zero> 941 0.0099 : | |
/* std::local_Rb_tree_increment(std::_Rb_tree_node_base*) total: 341 0.0036 */ | |
/* std::local_Rb_tree_decrement(std::_Rb_tree_node_base*) total: 344 0.0036 */ | |
/* std::local_Rb_tree_rotate_left(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*&) total: 130 0.0014 */ | |
/* std::local_Rb_tree_rotate_right(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*&) total: 126 0.0013 */ | |
/* | |
* Total samples for file : "LoopSimplify.cpp" | |
* | |
* 933 0.0098 | |
*/ | |
<credited to line zero> 933 0.0098 : | |
/* (anonymous namespace)::LoopSimplify::verifyAnalysis() const total: 42 4.4e-04 */ | |
/* llvm::Statistic::operator++() [clone .constprop.368] total: 7 7.3e-05 */ | |
/* placeSplitBlockCarefully(llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::BasicBlock*>&, llvm::Loop*) total: 10 1.0e-04 */ | |
/* (anonymous namespace)::LoopSimplify::getAnalysisUsage(llvm::AnalysisUsage&) const total: 1 1.0e-05 */ | |
/* rewriteLoopExitBlock(llvm::Loop*, llvm::BasicBlock*, llvm::DominatorTree*, llvm::LoopInfo*, bool) total: 46 4.8e-04 */ | |
/* separateNestedLoop(llvm::Loop*, llvm::BasicBlock*, llvm::DominatorTree*, llvm::LoopInfo*, llvm::ScalarEvolution*, bool, llvm::AssumptionCache*) total: 7 7.3e-05 */ | |
/* insertUniqueBackedgeBlock(llvm::Loop*, llvm::BasicBlock*, llvm::DominatorTree*, llvm::LoopInfo*) total: 6 6.3e-05 */ | |
/* simplifyOneLoop(llvm::Loop*, llvm::SmallVectorImpl<llvm::Loop*>&, llvm::DominatorTree*, llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::AssumptionCache*, bool) total: 441 0.0046 */ | |
/* (anonymous namespace)::LoopSimplify::runOnFunction(llvm::Function&) total: 373 0.0039 */ | |
/* | |
* Total samples for file : "/checkout/src/libcore/fmt/num.rs" | |
* | |
* 921 0.0097 | |
*/ | |
/* core::fmt::num::_$LT$impl$u20$core..fmt..LowerHex$u20$for$u20$u64$GT$::fmt::h93dd77e2e427362d total: 319 0.0033 */ | |
/* core::fmt::num::_$LT$impl$u20$core..fmt..Display$u20$for$u20$i32$GT$::fmt::h81761fb99fa5e254 total: 48 5.0e-04 */ | |
/* core::fmt::num::_$LT$impl$u20$core..fmt..Display$u20$for$u20$u64$GT$::fmt::h03a51c4602ebf0e5 total: 28 2.9e-04 */ | |
/* core::fmt::num::_$LT$impl$u20$core..fmt..Display$u20$for$u20$u64$GT$::fmt::h03a51c4602ebf0e5 total: 3 3.1e-05 */ | |
/* core::fmt::num::_$LT$impl$u20$core..fmt..Display$u20$for$u20$usize$GT$::fmt::hd186a95412e1e036 total: 468 0.0049 */ | |
/* core::fmt::num::_$LT$impl$u20$core..fmt..Display$u20$for$u20$u32$GT$::fmt::he2e65ad6dc613dfd total: 103 0.0011 */ | |
/* core::fmt::num::_$LT$impl$u20$core..fmt..Display$u20$for$u20$u128$GT$::fmt::h58d49bee8829e527 total: 2 2.1e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/sys/unix/ext/io.rs" | |
* | |
* 920 0.0097 | |
*/ | |
/* _$LT$std..fs..File$u20$as$u20$std..sys..imp..ext..io..FromRawFd$GT$::from_raw_fd::h0ae528c0b36c34d4 total: 342 0.0036 */ | |
/* _$LT$std..fs..File$u20$as$u20$std..sys..imp..ext..io..IntoRawFd$GT$::into_raw_fd::h128dfb8d8d213143 total: 578 0.0061 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/elf/do-rel.h" | |
* | |
* 896 0.0094 | |
*/ | |
/* | |
* Total samples for file : "PeepholeOptimizer.cpp" | |
* | |
* 884 0.0093 | |
*/ | |
<credited to line zero> 884 0.0093 : | |
/* (anonymous namespace)::ValueTrackerResult::getSrcSubReg(int) const [clone .constprop.284] total: 2 2.1e-05 */ | |
/* (anonymous namespace)::ValueTrackerResult::getSrcReg(int) const [clone .constprop.285] total: 2 2.1e-05 */ | |
/* (anonymous namespace)::CopyRewriter::getNextRewritableSource(unsigned int&, unsigned int&, unsigned int&, unsigned int&) total: 17 1.8e-04 */ | |
/* (anonymous namespace)::PeepholeOptimizer::isUncoalescableCopy(llvm::MachineInstr const&) [clone .isra.170] [clone .part.171] total: 11 1.2e-04 */ | |
/* llvm::DenseMapBase<llvm::SmallDenseMap<llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult, 4u, llvm::DenseMapInfo<llvm::TargetInstrInfo::RegSubRegPair>, llvm::detail::DenseMapPair<llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult> >, llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult, llvm::DenseMapInfo<llvm::TargetInstrInfo::RegSubRegPair>, llvm::detail::DenseMapPair<llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult> >::getBucketsEnd() total: 6 6.3e-05 */ | |
/* bool llvm::DenseMapBase<llvm::SmallDenseMap<llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult, 4u, llvm::DenseMapInfo<llvm::TargetInstrInfo::RegSubRegPair>, llvm::detail::DenseMapPair<llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult> >, llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult, llvm::DenseMapInfo<llvm::TargetInstrInfo::RegSubRegPair>, llvm::detail::DenseMapPair<llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult> >::LookupBucketFor<llvm::TargetInstrInfo::RegSubRegPair>(llvm::TargetInstrInfo::RegSubRegPair const&, llvm::detail::DenseMapPair<llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult> const*&) const total: 15 1.6e-04 */ | |
/* getCopyRewriter(llvm::MachineInstr&, llvm::TargetInstrInfo const&, llvm::MachineRegisterInfo&) total: 7 7.3e-05 */ | |
/* (anonymous namespace)::PeepholeOptimizer::isNAPhysCopy(unsigned int) [clone .isra.87] total: 7 7.3e-05 */ | |
/* (anonymous namespace)::PeepholeOptimizer::optimizeExtInstr(llvm::MachineInstr*, llvm::MachineBasicBlock*, llvm::SmallPtrSetImpl<llvm::MachineInstr*>&) total: 31 3.3e-04 */ | |
/* (anonymous namespace)::ValueTrackerResult::ValueTrackerResult(unsigned int, unsigned int) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::PeepholeOptimizer::findNextSource(unsigned int, unsigned int, llvm::SmallDenseMap<llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult, 4u, llvm::DenseMapInfo<llvm::TargetInstrInfo::RegSubRegPair>, llvm::detail::DenseMapPair<llvm::TargetInstrInfo::RegSubRegPair, (anonymous namespace)::ValueTrackerResult> >&) [clone .part.254] total: 92 9.7e-04 */ | |
/* (anonymous namespace)::PeepholeOptimizer::runOnMachineFunction(llvm::MachineFunction&) [clone .part.262] total: 687 0.0072 */ | |
/* (anonymous namespace)::PeepholeOptimizer::runOnMachineFunction(llvm::MachineFunction&) total: 6 6.3e-05 */ | |
/* | |
* Total samples for file : "CaptureTracking.cpp" | |
* | |
* 873 0.0092 | |
*/ | |
<credited to line zero> 873 0.0092 : | |
/* (anonymous namespace)::SimpleCaptureTracker::tooManyUses() total: 13 1.4e-04 */ | |
/* (anonymous namespace)::CapturesBefore::tooManyUses() total: 3 3.1e-05 */ | |
/* (anonymous namespace)::CapturesBefore::captured(llvm::Use const*) total: 9 9.4e-05 */ | |
/* (anonymous namespace)::SimpleCaptureTracker::captured(llvm::Use const*) total: 44 4.6e-04 */ | |
/* (anonymous namespace)::CapturesBefore::isSafeToPrune(llvm::Instruction*) total: 564 0.0059 */ | |
/* (anonymous namespace)::CapturesBefore::shouldExplore(llvm::Use const*) total: 240 0.0025 */ | |
/* | |
* Total samples for file : "MachineCSE.cpp" | |
* | |
* 865 0.0091 | |
*/ | |
<credited to line zero> 865 0.0091 : | |
/* llvm::MachineInstrExpressionTrait::isEqual(llvm::MachineInstr const* const&, llvm::MachineInstr const* const&) [clone .isra.55] [clone .constprop.273] total: 21 2.2e-04 */ | |
/* llvm::MachineInstrExpressionTrait::isEqual(llvm::MachineInstr const* const&, llvm::MachineInstr const* const&) [clone .isra.55] [clone .constprop.274] total: 8 8.4e-05 */ | |
/* (anonymous namespace)::MachineCSE::~MachineCSE() total: 2 2.1e-05 */ | |
/* (anonymous namespace)::MachineCSE::releaseMemory() total: 25 2.6e-04 */ | |
/* (anonymous namespace)::MachineCSE::PhysRegDefsReach(llvm::MachineInstr*, llvm::MachineInstr*, llvm::SmallSet<unsigned int, 8u, std::less<unsigned int> >&, llvm::SmallVectorImpl<unsigned int>&, bool&) const [clone .isra.232] total: 2 2.1e-05 */ | |
/* (anonymous namespace)::MachineCSE::hasLivePhysRegDefUses(llvm::MachineInstr const*, llvm::MachineBasicBlock const*, llvm::SmallSet<unsigned int, 8u, std::less<unsigned int> >&, llvm::SmallVectorImpl<unsigned int>&, bool&) const total: 53 5.6e-04 */ | |
/* (anonymous namespace)::MachineCSE::ProcessBlock(llvm::MachineBasicBlock*) total: 586 0.0062 */ | |
/* (anonymous namespace)::MachineCSE::ExitScope(llvm::MachineBasicBlock*) total: 16 1.7e-04 */ | |
/* (anonymous namespace)::MachineCSE::PerformCSE(llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*) total: 139 0.0015 */ | |
/* (anonymous namespace)::MachineCSE::runOnMachineFunction(llvm::MachineFunction&) total: 12 1.3e-04 */ | |
/* (anonymous namespace)::MachineCSE::getAnalysisUsage(llvm::AnalysisUsage&) const total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "ArgumentPromotion.cpp" | |
* | |
* 852 0.0089 | |
*/ | |
<credited to line zero> 852 0.0089 : | |
/* llvm::Optional<llvm::AAResults>::reset() [clone .part.118] total: 11 1.2e-04 */ | |
/* std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_deallocate(unsigned long*, unsigned long) [clone .isra.184] total: 2 2.1e-05 */ | |
/* std::_Vector_base<llvm::Value*, std::allocator<llvm::Value*> >::_M_deallocate(llvm::Value**, unsigned long) [clone .isra.209] total: 3 3.1e-05 */ | |
/* llvm::Statistic::operator++() [clone .constprop.521] total: 1 1.0e-05 */ | |
/* void std::vector<unsigned long, std::allocator<unsigned long> >::_M_initialize_dispatch<int>(int, int, std::__true_type) [clone .isra.455] total: 21 2.2e-04 */ | |
/* std::_Rb_tree<std::vector<unsigned long, std::allocator<unsigned long> >, std::vector<unsigned long, std::allocator<unsigned long> >, std::_Identity<std::vector<unsigned long, std::allocator<unsigned long> > >, std::less<std::vector<unsigned long, std::allocator<unsigned long> > >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >::_M_upper_bound(std::_Rb_tree_node<std::vector<unsigned long, std::allocator<unsigned long> > >*, std::_Rb_tree_node<std::vector<unsigned long, std::allocator<unsigned long> > >*, std::vector<unsigned long, std::allocator<unsigned long> > const&) [clone .isra.444] total: 12 1.3e-04 */ | |
/* std::_Rb_tree<std::pair<llvm::Argument*, std::vector<unsigned long, std::allocator<unsigned long> > >, std::pair<std::pair<llvm::Argument*, std::vector<unsigned long, std::allocator<unsigned long> > > const, llvm::LoadInst*>, std::_Select1st<std::pair<std::pair<llvm::Argument*, std::vector<unsigned long, std::allocator<unsigned long> > > const, llvm::LoadInst*> >, std::less<std::pair<llvm::Argument*, std::vector<unsigned long, std::allocator<unsigned long> > > >, std::allocator<std::pair<std::pair<llvm::Argument*, std::vector<unsigned long, std::allocator<unsigned long> > > const, llvm::LoadInst*> > >::_M_lower_bound(std::_Rb_tree_node<std::pair<std::pair<llvm::Argument*, std::vector<unsigned long, std::allocator<unsigned long> > > const, llvm::LoadInst*> >*, std::_Rb_tree_node<std::pair<std::pair<llvm::Argument*, std::vector<unsigned long, std::allocator<unsigned long> > > const, llvm::LoadInst*> >*, std::pair<llvm::Argument*, std::vector<unsigned long, std::allocator<unsigned long> > > const&) [clone .isra.448] total: 15 1.6e-04 */ | |
/* MarkIndicesSafe(std::vector<unsigned long, std::allocator<unsigned long> > const&, std::set<std::vector<unsigned long, std::allocator<unsigned long> >, std::less<std::vector<unsigned long, std::allocator<unsigned long> > >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&) total: 4 4.2e-05 */ | |
/* llvm::Optional<llvm::BasicAAResult>::reset() [clone .part.387] total: 3 3.1e-05 */ | |
/* (anonymous namespace)::ArgPromotion::runOnSCC(llvm::CallGraphSCC&)::{lambda(llvm::Function&)#1}::operator()(llvm::Function&) const total: 12 1.3e-04 */ | |
/* llvm::AAResults& llvm::function_ref<llvm::AAResults& (llvm::Function&)>::callback_fn<(anonymous namespace)::ArgPromotion::runOnSCC(llvm::CallGraphSCC&)::{lambda(llvm::Function&)#1}>(long, llvm::Function&) total: 5 5.2e-05 */ | |
/* isSafeToPromoteArgument(llvm::Argument*, bool, llvm::AAResults&, unsigned int) total: 320 0.0034 */ | |
/* DoPromotion(llvm::Function*, llvm::SmallPtrSetImpl<llvm::Argument*>&, llvm::SmallPtrSetImpl<llvm::Argument*>&, llvm::CallGraph&) total: 153 0.0016 */ | |
/* (anonymous namespace)::ArgPromotion::runOnSCC(llvm::CallGraphSCC&) [clone .part.495] total: 254 0.0027 */ | |
/* (anonymous namespace)::ArgPromotion::runOnSCC(llvm::CallGraphSCC&) total: 36 3.8e-04 */ | |
/* | |
* Total samples for file : "/build/eglibc-oGUzwX/eglibc-2.19/elf/../sysdeps/x86_64/dl-machine.h" | |
* | |
* 838 0.0088 | |
*/ | |
/* | |
* Total samples for file : "/checkout/src/libstd/collections/hash/table.rs" | |
* | |
* 808 0.0085 | |
*/ | |
/* std::collections::hash::table::calculate_allocation::h915adbeb0a3e8c1c total: 973 0.0102 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/ffi/c_str.rs" | |
* | |
* 800 0.0084 | |
*/ | |
/* std::ffi::c_str::CString::_new::h7e8c9c314ee51dd3 total: 296 0.0031 */ | |
/* std::ffi::c_str::CString::from_vec_unchecked::h85b5c0118214c88b total: 29 3.0e-04 */ | |
/* std::ffi::c_str::CString::from_vec_unchecked::h85b5c0118214c88b total: 316 0.0033 */ | |
/* _$LT$std..ffi..c_str..CString$u20$as$u20$core..ops..Deref$GT$::deref::h317c01db802d3188 total: 90 9.4e-04 */ | |
/* std::ffi::c_str::CStr::from_ptr::h0cdeace758d77ef4 total: 2 2.1e-05 */ | |
/* std::ffi::c_str::CStr::from_bytes_with_nul::hc965bde883802d0c total: 17 1.8e-04 */ | |
/* std::ffi::c_str::CStr::as_ptr::hb26c449c4f84066e total: 164 0.0017 */ | |
/* std::ffi::c_str::CStr::to_str::h5b71f53e5bbca26d total: 3 3.1e-05 */ | |
/* | |
* Total samples for file : "Loads.cpp" | |
* | |
* 785 0.0082 | |
*/ | |
<credited to line zero> 785 0.0082 : | |
/* AreEquivalentAddressValues(llvm::Value const*, llvm::Value const*) total: 107 0.0011 */ | |
/* isDereferenceableAndAlignedPointer(llvm::Value const*, unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&) total: 678 0.0071 */ | |
/* | |
* Total samples for file : "NVPTXGenericToNVVM.cpp" | |
* | |
* 778 0.0082 | |
*/ | |
<credited to line zero> 778 0.0082 : | |
/* llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >::ValueMapCallbackVH(llvm::Value*) [clone .constprop.241] total: 211 0.0022 */ | |
/* llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >::ValueMapCallbackVH(llvm::Value*) [clone .constprop.240] total: 565 0.0059 */ | |
/* llvm::Twine::Twine(char const*) [clone .constprop.251] total: 2 2.1e-05 */ | |
/* | |
* Total samples for file : "MachineBlockPlacement.cpp" | |
* | |
* 777 0.0082 | |
*/ | |
<credited to line zero> 777 0.0082 : | |
/* llvm::DenseMap<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >::grow(unsigned int) total: 3 3.1e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >, llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >::initEmpty() total: 2 2.1e-05 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >, llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >::LookupBucketFor<llvm::MachineBasicBlock*>(llvm::MachineBasicBlock* const&, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> const*&) const total: 49 5.1e-04 */ | |
/* llvm::DenseMap<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >::init(unsigned int) total: 1 1.0e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >, llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >::clear() total: 9 9.4e-05 */ | |
/* void std::__advance<llvm::ilist_iterator<llvm::MachineBasicBlock>, long>(llvm::ilist_iterator<llvm::MachineBasicBlock>&, long, std::bidirectional_iterator_tag) [clone .isra.181] total: 8 8.4e-05 */ | |
/* llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*>* llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >, llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >::InsertIntoBucketImpl<llvm::MachineBasicBlock*>(llvm::MachineBasicBlock* const&, llvm::MachineBasicBlock* const&, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*>*) [clone .isra.252] total: 7 7.3e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >, llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >::FindAndConstruct(llvm::MachineBasicBlock* const&) total: 12 1.3e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >, llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*, llvm::DenseMapInfo<llvm::MachineBasicBlock*>, llvm::detail::DenseMapPair<llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain*> >::FindAndConstruct(llvm::MachineBasicBlock*&&) total: 2 2.1e-05 */ | |
/* std::default_delete<llvm::BranchFolder::MBFIWrapper>::operator()(llvm::BranchFolder::MBFIWrapper*) const [clone .isra.206] total: 1 1.0e-05 */ | |
/* llvm::SpecificBumpPtrAllocator<(anonymous namespace)::BlockChain>::DestroyAll()::{lambda(char*, char*)#1}::operator()(char*, char*) const [clone .isra.146] total: 5 5.2e-05 */ | |
/* (anonymous namespace)::MachineBlockPlacement::selectBestCandidateBlock((anonymous namespace)::BlockChain&, llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&)::{lambda(llvm::MachineBasicBlock*)#1}::operator()(llvm::MachineBasicBlock*) const total: 2 2.1e-05 */ | |
/* llvm::SmallPtrSetImpl<(anonymous namespace)::BlockChain*>::insert((anonymous namespace)::BlockChain*) total: 9 9.4e-05 */ | |
/* (anonymous namespace)::MachineBlockPlacement::fillWorkLists(llvm::MachineBasicBlock*, llvm::SmallPtrSetImpl<(anonymous namespace)::BlockChain*>&, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 16u> const*) [clone .constprop.326] total: 57 6.0e-04 */ | |
/* (anonymous namespace)::MachineBlockPlacement::markChainSuccessors((anonymous namespace)::BlockChain&, llvm::MachineBasicBlock*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 16u> const*) total: 29 3.0e-04 */ | |
/* (anonymous namespace)::MachineBlockPlacement::markChainSuccessors((anonymous namespace)::BlockChain&, llvm::MachineBasicBlock*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 16u> const*) [clone .constprop.333] total: 56 5.9e-04 */ | |
/* llvm::Pass* llvm::callDefaultCtor<(anonymous namespace)::MachineBlockPlacement>() total: 1 1.0e-05 */ | |
/* getLayoutSuccessorProbThreshold(llvm::MachineBasicBlock*) total: 7 7.3e-05 */ | |
/* llvm::SpecificBumpPtrAllocator<(anonymous namespace)::BlockChain>::DestroyAll() total: 3 3.1e-05 */ | |
/* (anonymous namespace)::MachineBlockPlacement::selectBestCandidateBlock((anonymous namespace)::BlockChain&, llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&) total: 79 8.3e-04 */ | |
/* (anonymous namespace)::MachineBlockPlacement::buildChain(llvm::MachineBasicBlock*, (anonymous namespace)::BlockChain&, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 16u> const*) total: 115 0.0012 */ | |
/* (anonymous namespace)::MachineBlockPlacement::buildLoopChains(llvm::MachineLoop&) total: 80 8.4e-04 */ | |
/* (anonymous namespace)::MachineBlockPlacement::buildCFGChains() total: 212 0.0022 */ | |
/* (anonymous namespace)::MachineBlockPlacement::runOnMachineFunction(llvm::MachineFunction&) [clone .part.318] total: 26 2.7e-04 */ | |
/* (anonymous namespace)::MachineBlockPlacement::runOnMachineFunction(llvm::MachineFunction&) total: 2 2.1e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/libcollections/str.rs" | |
* | |
* 755 0.0079 | |
*/ | |
/* collections::str::_$LT$impl$u20$collections..borrow..ToOwned$u20$for$u20$str$GT$::to_owned::h887ca5d00e94db27 total: 7 7.3e-05 */ | |
/* collections::str::_$LT$impl$u20$collections..borrow..ToOwned$u20$for$u20$str$GT$::to_owned::h887ca5d00e94db27 total: 981 0.0103 */ | |
/* collections::str::_$LT$impl$u20$str$GT$::trim::ha3b68e8655c8068b total: 50 5.2e-04 */ | |
/* collections::str::_$LT$impl$u20$str$GT$::trim::ha3b68e8655c8068b total: 8 8.4e-05 */ | |
/* | |
* Total samples for file : "/checkout/src/libstd/sys/unix/mod.rs" | |
* | |
* 747 0.0078 | |
*/ | |
/* | |
* Total samples for file : "/root/.cargo/git/checkouts/hyper-817b53a166fc1c58/499c0d1/src/http/h1/parse.rs" | |
* | |
* 743 0.0078 | |
*/ | |
:use std::borrow::Cow; | |
:use std::fmt::{self, Write}; | |
: | |
:use httparse; | |
: | |
:use header::{self, Headers, ContentLength, TransferEncoding}; | |
:use http::{MessageHead, RawStatus, Http1Transaction, ParseResult, ServerTransaction, ClientTransaction, RequestLine}; | |
:use http::h1::{Encoder, Decoder}; | |
:use http::buf::{MemBuf, MemSlice, MemStr}; | |
:use method::Method; | |
:use status::StatusCode; | |
:use version::HttpVersion::{Http10, Http11}; | |
: | |
:const MAX_HEADERS: usize = 100; | |
:const AVERAGE_HEADER_SIZE: usize = 30; // totally scientific | |
: | |
:pub fn parse<T: Http1Transaction<Incoming=I>, I>(buf: &MemBuf) -> ParseResult<I> { | |
2 2.1e-05 : if buf.len() == 0 { | |
19 2.0e-04 : return Ok(None); | |
: } | |
: trace!("parse({:?})", buf); | |
1 1.0e-05 : <T as Http1Transaction>::parse(buf) | |
:} | |
: | |
:impl Http1Transaction for ServerTransaction { | |
: type Incoming = RequestLine; | |
: type Outgoing = StatusCode; | |
: | |
559 0.0059 : fn parse(buf: &MemBuf) -> ParseResult<RequestLine> { /* hyper::http::h1::parse::_$LT$impl$u20$hyper..http..Http1Transaction$u20$for$u20$hyper..http..ServerTransaction$GT$::parse::he33ea91951d964b1 total: 633 0.0066 */ | |
: let mut headers = [httparse::EMPTY_HEADER; MAX_HEADERS]; | |
: trace!("Request.parse([Header; {}], [u8; {}])", headers.len(), buf.len()); | |
: let mut req = httparse::Request::new(&mut headers); | |
3 3.1e-05 : Ok(match try!(req.parse(buf.bytes())) { | |
3 3.1e-05 : httparse::Status::Complete(len) => { | |
: trace!("Request.parse Complete({})", len); | |
: let slice = buf.slice(len); | |
: let path = req.path.unwrap(); | |
: let path_start = path.as_ptr() as usize - slice.as_ref().as_ptr() as usize; | |
: let path_end = path_start + path.len(); | |
: let path = slice.slice(path_start..path_end); | |
: // path was found to be utf8 by httparse | |
: let path = unsafe { MemStr::from_utf8_unchecked(path) }; | |
8 8.4e-05 : let subject = RequestLine( | |
5 5.2e-05 : try!(req.method.unwrap().parse()), | |
3 3.1e-05 : try!(::uri::from_mem_str(path)), | |
: ); | |
: let mut headers = Headers::with_capacity(req.headers.len()); | |
1 1.0e-05 : headers.extend(HeadersAsMemSliceIter { | |
2 2.1e-05 : headers: req.headers.iter(), | |
: slice: slice, | |
: }); | |
: | |
1 1.0e-05 : Some((MessageHead { | |
: version: if req.version.unwrap() == 1 { Http11 } else { Http10 }, | |
: subject: subject, | |
: headers: headers, | |
2 2.1e-05 : }, len)) | |
: } | |
: httparse::Status::Partial => None, | |
: }) | |
1 1.0e-05 : } | |
: | |
1 1.0e-05 : fn decoder(head: &MessageHead<Self::Incoming>) -> ::Result<Decoder> { /* hyper::http::h1::parse::_$LT$impl$u20$hyper..http..Http1Transaction$u20$for$u20$hyper..http..ServerTransaction$GT$::decoder::hca5f1e25cea92d93 total: 5 5.2e-05 */ | |
: use ::header; | |
1 1.0e-05 : if let Some(&header::ContentLength(len)) = head.headers.get() { | |
: Ok(Decoder::length(len)) | |
: } else if head.headers.has::<header::TransferEncoding>() { | |
: //TODO: check for Transfer-Encoding: chunked | |
: Ok(Decoder::chunked()) | |
: } else { | |
: Ok(Decoder::length(0)) | |
: } | |
3 3.1e-05 : } | |
: | |
: | |
4 4.2e-05 : fn encode(head: &mut MessageHead<Self::Outgoing>, dst: &mut Vec<u8>) -> Encoder { /* hyper::http::h1::parse::_$LT$impl$u20$hyper..http..Http1Transaction$u20$for$u20$hyper..http..ServerTransaction$GT$::encode::h841526a78b4c21c1 total: 74 7.8e-04 */ | |
: use ::header; | |
: trace!("writing head: {:?}", head); | |
: | |
2 2.1e-05 : if !head.headers.has::<header::Date>() { | |
: head.headers.set(header::Date(header::HttpDate(::time::now_utc()))); | |
: } | |
: | |
: let mut is_chunked = true; | |
: let mut body = Encoder::chunked(); | |
: if let Some(cl) = head.headers.get::<header::ContentLength>() { | |
: body = Encoder::length(**cl); | |
: is_chunked = false | |
: } | |
: | |
: if is_chunked { | |
: let encodings = match head.headers.get_mut::<header::TransferEncoding>() { | |
: Some(&mut header::TransferEncoding(ref mut encodings)) => { | |
: if encodings.last() != Some(&header::Encoding::Chunked) { | |
: encodings.push(header::Encoding::Chunked); | |
: } | |
: false | |
: }, | |
: None => true | |
: }; | |
: | |
: if encodings { | |
: head.headers.set(header::TransferEncoding(vec![header::Encoding::Chunked])); | |
: } | |
: } | |
: | |
: | |
2 2.1e-05 : let init_cap = 30 + head.headers.len() * AVERAGE_HEADER_SIZE; | |
: dst.reserve(init_cap); | |
: debug!("writing headers = {:?}", head.headers); | |
7 7.3e-05 : if head.version == ::HttpVersion::Http11 && head.subject == ::StatusCode::Ok { | |
: extend(dst, b"HTTP/1.1 200 OK\r\n"); | |
: let _ = write!(FastWrite(dst), "{}\r\n", head.headers); | |
: } else { | |
4 4.2e-05 : let _ = write!(FastWrite(dst), "{} {}\r\n{}\r\n", head.version, head.subject, head.headers); | |
: } | |
4 4.2e-05 : body | |
1 1.0e-05 : } | |
: | |
7 7.3e-05 : fn should_set_length(_head: &MessageHead<Self::Outgoing>) -> bool { /* hyper::http::h1::parse::_$LT$impl$u20$hyper..http..Http1Transaction$u20$for$u20$hyper..http..ServerTransaction$GT$::should_set_length::hff27b3857cd851a1 total: 7 7.3e-05 */ | |
: //TODO: pass method, check if method == HEAD | |
: true | |
: } | |
:} | |
: | |
:impl Http1Transaction for ClientTransaction { | |
: type Incoming = RawStatus; | |
: type Outgoing = RequestLine; | |
: | |
: fn parse(buf: &MemBuf) -> ParseResult<RawStatus> { | |
: let mut headers = [httparse::EMPTY_HEADER; MAX_HEADERS]; | |
: trace!("Response.parse([Header; {}], [u8; {}])", headers.len(), buf.len()); | |
: let mut res = httparse::Response::new(&mut headers); | |
: Ok(match try!(res.parse(buf.bytes())) { | |
: httparse::Status::Complete(len) => { | |
: trace!("Response.try_parse Complete({})", len); | |
: let code = res.code.unwrap(); | |
: let reason = match StatusCode::from_u16(code).canonical_reason() { | |
: Some(reason) if reason == res.reason.unwrap() => Cow::Borrowed(reason), | |
: _ => Cow::Owned(res.reason.unwrap().to_owned()) | |
: }; | |
: let mut headers = Headers::with_capacity(res.headers.len()); | |
: let slice = buf.slice(len); | |
: headers.extend(HeadersAsMemSliceIter { | |
: headers: res.headers.iter(), | |
: slice: slice, | |
: }); | |
: Some((MessageHead { | |
: version: if res.version.unwrap() == 1 { Http11 } else { Http10 }, | |
: subject: RawStatus(code, reason), | |
: headers: headers, | |
: }, len)) | |
: }, | |
: httparse::Status::Partial => None, | |
: }) | |
: } | |
: | |
: fn decoder(inc: &MessageHead<Self::Incoming>) -> ::Result<Decoder> { | |
: use ::header; | |
: // According to https://tools.ietf.org/html/rfc7230#section-3.3.3 | |
: // 1. HEAD responses, and Status 1xx, 204, and 304 cannot have a body. | |
: // 2. Status 2xx to a CONNECT cannot have a body. | |
: // | |
: // First two steps taken care of before this method. | |
: // | |
: // 3. Transfer-Encoding: chunked has a chunked body. | |
: // 4. If multiple differing Content-Length headers or invalid, close connection. | |
: // 5. Content-Length header has a sized body. | |
: // 6. Not Client. | |
: // 7. Read till EOF. | |
: if let Some(&header::TransferEncoding(ref codings)) = inc.headers.get() { | |
: if codings.last() == Some(&header::Encoding::Chunked) { | |
: Ok(Decoder::chunked()) | |
: } else { | |
: trace!("not chunked. read till eof"); | |
: Ok(Decoder::eof()) | |
: } | |
: } else if let Some(&header::ContentLength(len)) = inc.headers.get() { | |
: Ok(Decoder::length(len)) | |
: } else if inc.headers.has::<header::ContentLength>() { | |
: trace!("illegal Content-Length: {:?}", inc.headers.get_raw("Content-Length")); | |
: Err(::Error::Header) | |
: } else { | |
: trace!("neither Transfer-Encoding nor Content-Length"); | |
: Ok(Decoder::eof()) | |
: } | |
: } | |
: | |
: fn encode(head: &mut MessageHead<Self::Outgoing>, dst: &mut Vec<u8>) -> Encoder { | |
: trace!("writing head: {:?}", head); | |
: | |
: | |
: let mut body = Encoder::length(0); | |
: let expects_no_body = match head.subject.0 { | |
: Method::Head | Method::Get | Method::Connect => true, | |
: _ => false | |
: }; | |
: let mut chunked = false; | |
: | |
: if let Some(con_len) = head.headers.get::<ContentLength>() { | |
: body = Encoder::length(**con_len); | |
: } else { | |
: chunked = !expects_no_body; | |
: } | |
: | |
: if chunked { | |
: body = Encoder::chunked(); | |
: let encodings = match head.headers.get_mut::<TransferEncoding>() { | |
: Some(encodings) => { | |
: if !encodings.contains(&header::Encoding::Chunked) { | |
: encodings.push(header::Encoding::Chunked); | |
: } | |
: true | |
: }, | |
: None => false | |
: }; | |
: | |
: if !encodings { | |
: head.headers.set(TransferEncoding(vec![header::Encoding::Chunked])); | |
: } | |
: } | |
: | |
: let init_cap = 30 + head.headers.len() * AVERAGE_HEADER_SIZE; | |
: dst.reserve(init_cap); | |
: debug!("writing {:#?}", head.headers); | |
: let _ = write!(FastWrite(dst), "{} {}\r\n{}\r\n", head.subject, head.version, head.headers); | |
: | |
: body | |
: } | |
: | |
: | |
: fn should_set_length(head: &MessageHead<Self::Outgoing>) -> bool { | |
: match &head.subject.0 { | |
: &Method::Get | &Method::Head => false, | |
: _ => true | |
: } | |
: } | |
:} | |
: | |
:struct HeadersAsMemSliceIter<'a> { | |
: headers: ::std::slice::Iter<'a, httparse::Header<'a>>, | |
: slice: MemSlice, | |
:} | |
: | |
:impl<'a> Iterator for HeadersAsMemSliceIter<'a> { | |
: type Item = (&'a str, MemSlice); | |
13 1.4e-04 : fn next(&mut self) -> Option<Self::Item> { /* _$LT$hyper..http..h1..parse..HeadersAsMemSliceIter$LT$$u27$a$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h2974d7fd3f35cea8 total: 227 0.0024 */ | |
: self.headers.next().map(|header| { | |
1 1.0e-05 : let value_start = header.value.as_ptr() as usize - self.slice.as_ref().as_ptr() as usize; | |
: let value_end = value_start + header.value.len(); | |
: (header.name, self.slice.slice(value_start..value_end)) | |
: }) | |
6 6.3e-05 : } | |
:} | |
: | |
:struct FastWrite<'a>(&'a mut Vec<u8>); | |
: | |
:impl<'a> fmt::Write for FastWrite<'a> { | |
43 4.5e-04 : fn write_str(&mut self, s: &str) -> fmt::Result { /* _$LT$hyper..http..h1..parse..FastWrite$LT$$u27$a$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h47b1de04f5b1d847 total: 100 0.0010 */ | |
1 1.0e-05 : extend(self.0, s.as_bytes()); | |
: Ok(()) | |
14 1.5e-04 : } | |
: | |
: fn write_fmt(&mut self, args: fmt::Arguments) -> fmt::Result { | |
: fmt::write(self, args) | |
: } | |
:} | |
: | |
:fn extend(dst: &mut Vec<u8>, data: &[u8]) { | |
: use std::ptr; | |
: dst.reserve(data.len()); | |
: let prev = dst.len(); | |
: unsafe { | |
10 1.0e-04 : ptr::copy_nonoverlapping(data.as_ptr(), | |
: dst.as_mut_ptr().offset(prev as isize), | |
: data.len()); | |
9 9.4e-05 : dst.set_len(prev + data.len()); | |
: } | |
:} | |
: | |
:#[cfg(test)] | |
:mod tests { | |
: use http; | |
: use http::buf::MemBuf; | |
: use super::{parse}; | |
: | |
: #[test] | |
: fn test_parse_request() { | |
: let raw = MemBuf::from(b"GET /echo HTTP/1.1\r\nHost: hyper.rs\r\n\r\n".to_vec()); | |
: parse::<http::ServerTransaction, _>(&raw).unwrap(); | |
: } | |
: | |
: #[test] | |
: fn test_parse_request_errors() { | |
: let raw = MemBuf::from(b"GET htt:p// HTTP/1.1\r\nHost: hyper.rs\r\n\r\n".to_vec()); | |
: parse::<http::ServerTransaction, _>(&raw).unwrap_err(); | |
: } | |
: #[test] | |
: fn test_parse_raw_status() { | |
: let raw = MemBuf::from(b"HTTP/1.1 200 OK\r\n\r\n".to_vec()); | |
: let (res, _) = parse::<http::ClientTransaction, _>(&raw).unwrap().unwrap(); | |
: assert_eq!(res.subject.1, "OK"); | |
: | |
: let raw = MemBuf::from(b"HTTP/1.1 200 Howdy\r\n\r\n".to_vec()); | |
: let (res, _) = parse::<http::ClientTransaction, _>(&raw).unwrap().unwrap(); | |
: assert_eq!(res.subject.1, "Howdy"); | |
: } | |
: | |
: #[cfg(feature = "nightly")] | |
: use test::Bencher; | |
: | |
: #[cfg(feature = "nightly")] | |
: #[bench] | |
: fn bench_parse_incoming(b: &mut Bencher) { | |
: let mut raw = MemBuf::from(b"GET /super_long_uri/and_whatever?what_should_we_talk_about/\ | |
: I_wonder/Hard_to_write_in_an_uri_after_all/you_have_to_make\ | |
: _up_the_punctuation_yourself/how_fun_is_that?test=foo&test1=\ | |
: foo1&test2=foo2&test3=foo3&test4=foo4 HTTP/1.1\r\nHost: \ | |
: hyper.rs\r\nAccept: a lot of things\r\nAccept-Charset: \ | |
: utf8\r\nAccept-Encoding: *\r\nAccess-Control-Allow-\ | |
: Credentials: None\r\nAccess-Control-Allow-Origin: None\r\n\ | |
: Access-Control-Allow-Methods: None\r\nAccess-Control-Allow-\ | |
: Headers: None\r\nContent-Encoding: utf8\r\nContent-Security-\ | |
: Policy: None\r\nContent-Type: text/html\r\nOrigin: hyper\ | |
: \r\nSec-Websocket-Extensions: It looks super important!\r\n\ | |
: Sec-Websocket-Origin: hyper\r\nSec-Websocket-Version: 4.3\r\ | |
: \nStrict-Transport-Security: None\r\nUser-Agent: hyper\r\n\ | |
: X-Content-Duration: None\r\nX-Content-Security-Policy: None\ | |
: \r\nX-DNSPrefetch-Control: None\r\nX-Frame-Options: \ | |
: Something important obviously\r\nX-Requested-With: Nothing\ | |
: \r\n\r\n".to_vec()); | |
: b.iter(|| { | |
: parse::<http::ServerTransaction, _>(&raw).unwrap(); | |
: raw.restart(); | |
: }); | |
: } | |
:} | |
/* | |
* Total samples for file : "cargo.cgu-0.rs" | |
* | |
* 723 0.0076 | |
*/ | |
<credited to line zero> 723 0.0076 : | |
/* cargo::call_main_without_stdin::hfda89997db6bb3c4 total: 1 1.0e-05 */ | |
/* _$LT$collections..btree..map..IntoIter$LT$K$C$$u20$V$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h6051e17345f4b125 total: 3 3.1e-05 */ | |
/* _$LT$collections..btree..map..IntoIter$LT$K$C$$u20$V$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h91ce2c6f8bf9d462 total: 3 3.1e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$u20$as$u20$core..clone..Clone$GT$::clone::h870b5a6c3eb357d5 total: 47 4.9e-04 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$u20$as$u20$core..clone..Clone$GT$::clone::h970cb72f38e6c7e4 total: 1 1.0e-05 */ | |
/* collections::str::_$LT$impl$u20$str$GT$::replace::h04d7fabf13eed172 total: 4 4.2e-05 */ | |
/* collections::slice::_$LT$impl$u20$$u5b$T$u5d$$GT$::to_vec::h579c213c6bcbb4ad total: 9 9.4e-05 */ | |
/* collections::string::String::push::h843b35daf7f256b9 total: 2 2.1e-05 */ | |
/* rustc_serialize::collection_impls::_$LT$impl$u20$rustc_serialize..serialize..Decodable$u20$for$u20$std..collections..hash..map..HashMap$LT$K$C$$u20$V$GT$$GT$::decode::he82c8ce407e8156a total: 5 5.2e-05 */ | |
/* _$LT$alloc..arc..Arc$LT$T$GT$$GT$::drop_slow::h368c8381ce745543 total: 1 1.0e-05 */ | |
/* _$LT$F$u20$as$u20$crossbeam..FnBox$GT$::call_box::h3d83fe40572482cd total: 1 1.0e-05 */ | |
/* _$LT$core..option..Option$LT$T$GT$$GT$::map::hc278fb2375214889 total: 17 1.8e-04 */ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$GT$::reserve::h1721703c9a51f782 total: 1 1.0e-05 */ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$GT$::reserve::hae215e3ae2860928 total: 1 1.0e-05 */ | |
/* std::collections::hash::table::make_hash::h534e55c3f13595bf total: 1 1.0e-05 */ | |
/* std::collections::hash::table::make_hash::h555c682079516888 total: 1 1.0e-05 */ | |
/* std::fs::metadata::hf759c91f17f46392 total: 3 3.1e-05 */ | |
/* std::panicking::try::do_call::hb93b695d2e5a01f6 total: 1 1.0e-05 */ | |
/* _$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$::double::hb2e30eedd4c1c849 total: 2 2.1e-05 */ | |
/* _$LT$std..sync..mpsc..Sender$LT$T$GT$$GT$::send::h5a73fe9840d57dcb total: 2 2.1e-05 */ | |
/* core::cmp::impls::_$LT$impl$u20$core..cmp..PartialEq$LT$$RF$$u27$b$u20$B$GT$$u20$for$u20$$RF$$u27$a$u20$A$GT$::eq::h835fe08ba0325a04 total: 1 1.0e-05 */ | |
/* core::hash::impls::_$LT$impl$u20$core..hash..Hash$u20$for$u20$$RF$$u27$a$u20$T$GT$::hash::h9fd9c6ed5213250c total: 1 1.0e-05 */ | |
/* core::hash::impls::_$LT$impl$u20$core..hash..Hash$u20$for$u20$$RF$$u27$a$u20$T$GT$::hash::hf7ce9186251513b0 total: 1 1.0e-05 */ | |
/* core::iter::iterator::Iterator::collect::h8de87d356428b635 total: 2 2.1e-05 */ | |
/* drop::h094223b2f6ded0ec total: 1 1.0e-05 */ | |
/* drop::h27e00f5a5acd3d35 total: 3 3.1e-05 */ | |
/* drop::h3d19d83414d76bf6 total: 1 1.0e-05 */ | |
/* drop::h425717cdd767ff69 total: 1 1.0e-05 */ | |
/* drop::h4df3e06fe8afd42d total: 2 2.1e-05 */ | |
/* drop::h6a0b4d3a9a9badff total: 4 4.2e-05 */ | |
/* drop::h6c8c2087f6e4ca5a total: 2 2.1e-05 */ | |
/* drop::h7269ca9c2880d935 total: 14 1.5e-04 */ | |
/* drop::h75d24c8facf94ebf total: 18 1.9e-04 */ | |
/* drop::h877e86b8e01ca0ab total: 1 1.0e-05 */ | |
/* drop::h9dc75a175856a713 total: 7 7.3e-05 */ | |
/* drop::hb10a2db237d86247 total: 5 5.2e-05 */ | |
/* drop::hb91838b5c4caf682 total: 1 1.0e-05 */ | |
/* drop::hbea7c0548cbabad6 total: 1 1.0e-05 */ | |
/* drop::he16f674936221b95 total: 1 1.0e-05 */ | |
/* drop::he21591bb32f73d52 total: 2 2.1e-05 */ | |
/* drop::he3a2c99d8f2ec6f1 total: 1 1.0e-05 */ | |
/* drop::he61cc3db1d4656f5 total: 1 1.0e-05 */ | |
/* drop::hf8f9b8792ed0dc5e total: 3 3.1e-05 */ | |
/* toml::decoder::rustc_serialize::_$LT$impl$u20$rustc_serialize..serialize..Decoder$u20$for$u20$toml..decoder..Decoder$GT$::read_struct_field::h03b22fc7ddc302f1 total: 1 1.0e-05 */ | |
/* toml::decoder::rustc_serialize::_$LT$impl$u20$rustc_serialize..serialize..Decoder$u20$for$u20$toml..decoder..Decoder$GT$::read_struct_field::h7ec70d59cb017e4b total: 1 1.0e-05 */ | |
/* toml::decoder::rustc_serialize::_$LT$impl$u20$rustc_serialize..serialize..Decoder$u20$for$u20$toml..decoder..Decoder$GT$::read_struct_field::hfc0ddccbdba843f2 total: 1 1.0e-05 */ | |
/* _$LT$std..path..Path$u20$as$u20$core..hash..Hash$GT$::hash::h326083cbd9e80e95 total: 4 4.2e-05 */ | |
/* _$LT$collections..binary_heap..BinaryHeap$LT$T$GT$$GT$::sift_up::hb7e38d4a062409f4 total: 1 1.0e-05 */ | |
/* _$LT$$RF$$u27$a$u20$T$u20$as$u20$core..fmt..Display$GT$::fmt::hf721d0c17173eae3 total: 1 1.0e-05 */ | |
/* _$LT$collections..btree..map..BTreeMap$LT$K$C$$u20$V$GT$$GT$::insert::hbc0a64b742d57f52 total: 1 1.0e-05 */ | |
/* _$LT$collections..btree..map..BTreeMap$LT$K$C$$u20$V$GT$$GT$::remove::h077b447adc7529df total: 2 2.1e-05 */ | |
/* _$LT$collections..btree..map..BTreeMap$LT$K$C$$u20$V$GT$$GT$::remove::he7929728b05b90a7 total: 36 3.8e-04 */ | |
/* _$LT$semver..version..Version$u20$as$u20$core..hash..Hash$GT$::hash::h62347f7b6f663504 total: 4 4.2e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$GT$$GT$::with_capacity::h999bf1a52de7abdb total: 2 2.1e-05 */ | |
/* _$LT$std..collections..hash..set..HashSet$LT$T$C$$u20$S$GT$$GT$::insert::h410a5ae89d2d6cef total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..set..HashSet$LT$T$C$$u20$S$GT$$GT$::insert::hbc5b0d04beb08c01 total: 2 2.1e-05 */ | |
/* _$LT$std..collections..hash..set..HashSet$LT$T$C$$u20$S$GT$$GT$::remove::hc6966c94a59acefb total: 3 3.1e-05 */ | |
/* _$LT$std..collections..hash..set..HashSet$LT$T$C$$u20$S$GT$$GT$::contains::h667c667ad4a4fdc3 total: 1 1.0e-05 */ | |
/* _$LT$core..hash..sip..SipHasher$u20$as$u20$core..hash..Hasher$GT$::write::h703ae290d4804eb2 total: 19 2.0e-04 */ | |
/* _$LT$collections..string..String$u20$as$u20$core..fmt..Display$GT$::fmt::h41627ac7c6ac79e2 total: 1 1.0e-05 */ | |
/* _$LT$core..option..Option$LT$T$GT$$u20$as$u20$core..hash..Hash$GT$::hash::hafec5d734be4d246 total: 2 2.1e-05 */ | |
/* _$LT$std..collections..hash..table..RawTable$LT$K$C$$u20$V$GT$$GT$::new_uninitialized::h119c5a579c3dc955 total: 4 4.2e-05 */ | |
/* _$LT$core..option..Option$LT$T$GT$$u20$as$u20$core..clone..Clone$GT$::clone::hf6ccf80c6c8e3c77 total: 2 2.1e-05 */ | |
/* _$LT$std..sync..mpsc..Sender$LT$T$GT$$u20$as$u20$core..clone..Clone$GT$::clone::h0ecd285eea6a8783 total: 2 2.1e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::search_mut::h9df71a1fbead2cf3 total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::get::h05b27657858a1ba1 total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::get::h67fefb9d05b8727a total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::get::h9e4e222bb078627a total: 4 4.2e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::get::he3e7011a1c4584f5 total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::insert::h1980abbaf9143059 total: 3 3.1e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::insert::h27f55fba0299ee29 total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::insert::hf584b05f4d1c45b1 total: 2 2.1e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::insert::hfec8ec2b779fb0a2 total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::search::h5df7903815acbe18 total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::search::hb8a895273ff3d977 total: 4 4.2e-05 */ | |
/* _$LT$std..collections..hash..map..HashMap$LT$K$C$$u20$V$C$$u20$S$GT$$GT$::reserve::h640332e6ccf95aee total: 1 1.0e-05 */ | |
/* _$LT$$RF$$u27$a$u20$mut$u20$I$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h30b00e5f69356ecd total: 3 3.1e-05 */ | |
/* _$LT$$RF$$u27$a$u20$mut$u20$I$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h320256fa7c068727 total: 6 6.3e-05 */ | |
/* _$LT$$RF$$u27$a$u20$mut$u20$I$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h7f2e39d46fd194b5 total: 1 1.0e-05 */ | |
/* _$LT$std..collections..hash..map..Entry$LT$$u27$a$C$$u20$K$C$$u20$V$GT$$GT$::or_insert::h65ffc70956c1c175 total: 1 1.0e-05 */ | |
/* _$LT$term..terminfo..TerminfoTerminal$LT$T$GT$$u20$as$u20$term..Terminal$GT$::supports_attr::h1a3ab3526c2c74be total: 1 1.0e-05 */ | |
/* _$LT$term..terminfo..TerminfoTerminal$LT$T$GT$$u20$as$u20$term..Terminal$GT$::reset::hf7a0ac2fdbd3270e total: 1 1.0e-05 */ | |
/* _$LT$core..iter..Cloned$LT$I$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h63b83a2f6de26c9a total: 1 1.0e-05 */ | |
/* _$LT$core..iter..Cloned$LT$I$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::hdc2886056530d381 total: 1 1.0e-05 */ | |
/* _$LT$core..str..Lines$LT$$u27$a$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h7b42a571a2cf2f04 total: 57 6.0e-04 */ | |
/* _$LT$std..collections..hash..map..DefaultHasher$u20$as$u20$core..hash..Hasher$GT$::write::hfd71973413218d3b total: 73 7.7e-04 */ | |
/* _$LT$std..collections..hash..map..DefaultHasher$u20$as$u20$core..hash..Hasher$GT$::finish::ha9786edd4892f369 total: 14 1.5e-04 */ | |
/* _$LT$rustc_serialize..json..Decoder$u20$as$u20$rustc_serialize..serialize..Decoder$GT$::read_struct_field::h6f1a5de8b65099ab total: 14 1.5e-04 */ | |
/* _$LT$rustc_serialize..json..Decoder$u20$as$u20$rustc_serialize..serialize..Decoder$GT$::read_struct_field::hd79b0e96a380b645 total: 9 9.4e-05 */ | |
/* _$LT$rustc_serialize..json..Decoder$u20$as$u20$rustc_serialize..serialize..Decoder$GT$::read_struct_field::hf186d4d1122dc45c total: 7 7.3e-05 */ | |
/* _$LT$collections..btree..map..BTreeMap$LT$K$C$$u20$V$GT$$u20$as$u20$core..ops..Drop$GT$::drop::h8526fcfe077aa81a total: 3 3.1e-05 */ | |
/* _$LT$collections..btree..map..BTreeMap$LT$K$C$$u20$V$GT$$u20$as$u20$core..ops..Drop$GT$::drop::hc847c1b5905e9782 total: 1 1.0e-05 */ | |
/* _$LT$collections..btree..map..IntoIter$LT$K$C$$u20$V$GT$$u20$as$u20$core..ops..Drop$GT$::drop::h1f0a238e76b39ac3 total: 1 1.0e-05 */ | |
/* _$LT$core..iter..Filter$LT$I$C$$u20$P$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::hf166266999a98afc total: 2 2.1e-05 */ | |
/* _$LT$core..option..Option$LT$T$GT$$u20$as$u20$rustc_serialize..serialize..Decodable$GT$::decode::ha99638decdf12a02 total: 6 6.3e-05 */ | |
/* _$LT$core..option..Option$LT$T$GT$$u20$as$u20$rustc_serialize..serialize..Decodable$GT$::decode::_$u7b$$u7b$closure$u7d$$u7d$::ha62115d1d82fbdac total: 1 1.0e-05 */ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$u20$as$u20$rustc_serialize..serialize..Decodable$GT$::decode::h47927294250f3097 total: 5 5.2e-05 */ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$u20$as$u20$rustc_serialize..serialize..Decodable$GT$::decode::h5a7f19ebf0e0a853 total: 6 6.3e-05 */ | |
/* _$LT$collections..vec..Vec$LT$T$GT$$u20$as$u20$rustc_serialize..serialize..Encodable$GT$::encode::h5883708691b59275 total: 1 1.0e-05 */ | |
/* _$LT$core..iter..FilterMap$LT$I$C$$u20$F$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::hd56b33803cc3ae8c total: 1 1.0e-05 */ | |
/* _$LT$core..str..SplitN$LT$$u27$a$C$$u20$P$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$::next::h61f22bcc4fd03ff5 total: 7 7.3e-05 */ | |
/* _$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_char::h3b3cbace60c5da8e total: 1 1.0e-05 */ | |
/* _$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h4bbab47aec94446a total: 5 5.2e-05 */ | |
/* _$LT$cargo..core..source..SourceId$u20$as$u20$core..hash..Hash$GT$::hash::ha62c5aaffd9a236d total: 11 1.2e-04 */ | |
/* cargo::core::package_id::PackageId::new::h2217ad4677a14697 total: 3 3.1e-05 */ | |
/* cargo::core::resolver::activate::h3cb0b74b1e8389eb total: 2 2.1e-05 */ | |
/* cargo::core::resolver::activate_deps_loop::h48ace183c57e42ad total: 2 2.1e-05 */ | |
/* cargo::core::resolver::build_features::add_feature::hca15e6e834ba8a7a total: 1 1.0e-05 */ | |
/* cargo::core::resolver::Context::prev_active::h48370c8b14286ebb total: 1 1.0e-05 */ | |
/* cargo::core::resolver::check_cycles::visit::h5463b32994ad951d total: 1 1.0e-05 */ | |
/* cargo::core::registry::PackageRegistry::ensure_loaded::he80463f2e8747a75 total: 1 1.0e-05 */ | |
/* cargo::ops::cargo_compile::generate_targets::h94bf4322d109955f total: 1 1.0e-05 */ | |
/* cargo::ops::cargo_rustc::context::Context::target_filenames::_$u7b$$u7b$closure$u7d$$u7d$::h23d49cba36bd8d9e total: 1 1.0e-05 */ | |
/* cargo::ops::cargo_rustc::fingerprint::Fingerprint::update_local::hadd435597d02d335 total: 2 2.1e-05 */ | |
/* cargo::ops::cargo_rustc::fingerprint::calculate::hac2a1f6a541a175a total: 1 1.0e-05 */ | |
/* cargo::ops::cargo_rustc::fingerprint::write_fingerprint::hb528d8426cd69eb9 total: 8 8.4e-05 */ | |
/* _$LT$F$u20$as$u20$cargo..ops..cargo_rustc..job..FnBox$LT$A$C$$u20$R$GT$$GT$::call_box::h8094bc83eb5f9c28 total: 1 1.0e-05 */ | |
/* cargo::ops::cargo_rustc::job_queue::JobQueue::enqueue::h800afebfdfb44b46 total: 1 1.0e-05 */ | |
/* cargo::ops::cargo_rustc::job_queue::JobQueue::drain_the_queue::h090a994849b1e0a4 total: 13 1.4e-04 */ | |
/* cargo::ops::cargo_rustc::compile::hbbf109ce9745bc10 total: 1 1.0e-05 */ | |
/* cargo::ops::cargo_rustc::rustc::_$u7b$$u7b$closure$u7d$$u7d$::h90e79fe921d20901 total: 7 7.3e-05 */ | |
/* cargo::ops::cargo_rustc::add_plugin_deps::h3d5a6109b18df66f total: 1 1.0e-05 */ | |
/* cargo::sources::registry::index::RegistryIndex::summaries::h120e58c5f718c6c6 total: 2 2.1e-05 */ | |
/* cargo::sources::registry::index::RegistryIndex::parse_registry_package::h076b263740ae399f total: 20 2.1e-04 */ | |
/* cargo::util::config::Config::get::h86fba30fb8597e4d total: 1 1.0e-05 */ | |
/* cargo::util::config::Config::get_env::h2ea9481a6694ef28 total: 2 2.1e-05 */ | |
/* _$LT$cargo..util..graph..Graph$LT$N$GT$$GT$::add::h84d5213c81652551 total: 2 2.1e-05 */ | |
/* _$LT$cargo..util..graph..Graph$LT$N$GT$$GT$::edges::h5a47aa597bacaccb total: 2 2.1e-05 */ | |
/* cargo::util::paths::join_paths::hbcb3f483ee6af622 total: 2 2.1e-05 */ | |
/* cargo::util::process_builder::ProcessBuilder::env::h5caf68e1a631c256 total: 1 1.0e-05 */ | |
/* cargo::util::toml::TomlManifest::to_real_manifest::h2628c24aafce97b0 total: 1 1.0e-05 */ | |
/* cargo::util::toml::TomlManifest::replace::h6e484b150a754854 total: 1 1.0e-05 */ | |
/* cargo::util::toml::TomlDependency::to_dependency::h87343ee7a7332a39 total: 1 1.0e-05 */ | |
/* cargo::util::toml::normalize::configure::h0e13af1f61cde41c total: 1 1.0e-05 */ | |
/* cargo::util::toml::build_profiles::h6ff40afec28b44e2 total: 1 1.0e-05 */ | |
/* cargo::util::flock::Filesystem::open::_$u7b$$u7b$closure$u7d$$u7d$::h6f8d8efdb6c7795b total: 1 1.0e-05 */ | |
/* cargo::util::flock::acquire::h0af6ca9596c947ee total: 1 1.0e-05 */ | |
/* _$LT$cargo..core..dependency..DependencyInner$u20$as$u20$core..clone..Clone$GT$::clone::hfaa7e893df86ae9f total: 2 2.1e-05 */ | |
/* _$LT$cargo..core..manifest..Manifest$u20$as$u20$core..clone..Clone$GT$::clone::h9ea37390227ce64c total: 1 1.0e-05 */ | |
/* _$LT$cargo..core..manifest..Profile$u20$as$u20$core..hash..Hash$GT$::hash::hd203a2a30b15efc7 total: 2 2.1e-05 */ | |
/* _$LT$cargo..core..resolver..Context$LT$$u27$a$GT$$u20$as$u20$core..clone..Clone$GT$::clone::hd5da8788854f01a0 total: 72 7.6e-04 */ | |
/* _$LT$cargo..core..summary..Summary$u20$as$u20$core..clone..Clone$GT$::clone::h88074821c5bdf1bb total: 22 2.3e-04 */ | |
/* _$LT$cargo..util..toml..TomlManifest$u20$as$u20$rustc_serialize..serialize..Decodable$GT$::decode::_$u7b$$u7b$closure$u7d$$u7d$::hb42bd86c5dd24a8b total: 2 2.1e-05 */ | |
/* _$LT$cargo..util..toml..TomlProject$u20$as$u20$rustc_serialize..serialize..Decodable$GT$::decode::_$u7b$$u7b$closure$u7d$$u7d$::h318b6392570a7d5a total: 2 2.1e-05 */ | |
/* _$LT$cargo..util..toml..TomlTarget$u20$as$u20$rustc_serialize..serialize..Decodable$GT$::decode::_$u7b$$u7b$closure$u7d$$u7d$::hc198109b6cd0b6ef total: 1 1.0e-05 */ | |
/* | |
* Total samples for file : "MachineLICM.cpp" | |
* | |
* 713 0.0075 | |
*/ | |
<credited to line zero> 713 0.0075 : | |
/* llvm::SmallVectorImpl<unsigned int>::resize(unsigned long) [clone .part.284] total: 14 1.5e-04 */ | |
/* (anonymous namespace)::MachineLICM::IsLoopInvariantInst(llvm::MachineInstr&) [clone .part.364] total: 28 2.9e-04 */ | |
/* (anonymous namespace)::MachineLICM::IsLICMCandidate(llvm::MachineInstr&) [clone .part.363] total: 6 6.3e-05 */ | |
/* (anonymous namespace)::MachineLICM::HasLoopPHIUse(llvm::MachineInstr const*) const total: 12 1.3e-04 */ | |
/* (anonymous namespace)::MachineLICM::~MachineLICM() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::MachineLICM::~MachineLICM() total: 1 1.0e-05 */ | |
/* (anonymous namespace)::MachineLICM::releaseMemory() total: 13 1.4e-04 */ | |
/* (anonymous namespace)::MachineLICM::HoistRegionPostRA() total: 223 0.0023 */ | |
/* (anonymous namespace)::MachineLICM::calcRegisterCost(llvm::MachineInstr const*, bool, bool) total: 93 9.8e-04 */ | |
/* (anonymous namespace)::MachineLICM::IsProfitableToHoist(llvm::MachineInstr&) [clone .part.477] total: 8 8.4e-05 */ | |
/* (anonymous namespace)::MachineLICM::UpdateRegPressure(llvm::MachineInstr const*, bool) total: 108 0.0011 */ | |
/* (anonymous namespace)::MachineLICM::InitRegPressure(llvm::MachineBasicBlock*) total: 4 4.2e-05 */ | |
/* (anonymous namespace)::MachineLICM::HoistOutOfLoop(llvm::DomTreeNodeBase<llvm::MachineBasicBlock>*) total: 149 0.0016 */ | |
/* (anonymous namespace)::MachineLICM::runOnMachineFunction(llvm::MachineFunction&) total: 53 5.6e-04 */ | |
/* | |
* Total samples for file : "X86MCInstLower.cpp" | |
* | |
* 707 0.0074 | |
*/ | |
<credited to line zero> 707 0.0074 : | |
/* llvm::X86AsmPrinter::StackMapShadowTracker::count(llvm::MCInst&, llvm::MCSubtargetInfo const&, llvm::MCCodeEmitter*) [clone .part.250] total: 2 2.1e-05 */ | |
/* (anonymous namespace)::X86MCInstLower::LowerSymbolOperand(llvm::MachineOperand const&, llvm::MCSymbol*) const total: 43 4.5e-04 */ | |
/* (anonymous namespace)::X86MCInstLower::GetSymbolFromOperand(llvm::MachineOperand const&) const total: 77 8.1e-04 */ | |
/* (anonymous namespace)::X86MCInstLower::LowerMachineOperand(llvm::MachineInstr const*, llvm::MachineOperand const&) const total: 427 0.0045 */ | |
/* (anonymous namespace)::X86MCInstLower::Lower(llvm::MachineInstr const*, llvm::MCInst&) const total: 158 0.0017 */ | |
/* | |
* Total samples for file : "MachineScheduler.cpp" | |
* | |
* 696 0.0073 | |
*/ | |
<credited to line zero> 696 0.0073 : | |
/* __gnu_cxx::__exchange_and_add_dispatch(int*, int) [clone .constprop.711] total: 7 7.3e-05 */ | |
/* tryPressure(llvm::PressureChange const&, llvm::PressureChange const&, llvm::GenericSchedulerBase::SchedCandidate&, llvm::GenericSchedulerBase::SchedCandidate&, llvm::GenericSchedulerBase::CandReason, llvm::TargetRegisterInfo const*, llvm::MachineFunction const&) total: 36 3.8e-04 */ | |
/* (anonymous namespace)::CopyConstrain::~CopyConstrain() total: 7 7.3e-05 */ | |
/* llvm::SmallVectorImpl<unsigned int>::resize(unsigned long) [clone .part.426] total: 41 4.3e-04 */ | |
/* llvm::ScheduleDAGMILive::getPressureDiff(llvm::SUnit const*) [clone .isra.197] total: 1 1.0e-05 */ | |
/* biasPhysRegCopy(llvm::SUnit const*, bool) total: 48 5.0e-04 */ | |
/* priorNonDebug(llvm::MachineInstrBundleIterator<llvm::MachineInstr>, llvm::MachineInstrBundleIterator<llvm::MachineInstr const>) [clone .isra.378] total: 59 6.2e-04 */ | |
/* (anonymous namespace)::MachineSchedulerBase::scheduleRegions(llvm::ScheduleDAGInstrs&, bool) [clone .isra.364] total: 308 0.0032 */ | |
/* (anonymous namespace)::MacroFusion::apply(llvm::ScheduleDAGInstrs*) total: 65 6.8e-04 */ | |
/* tracePick(llvm::GenericSchedulerBase::CandReason, bool) total: 10 1.0e-04 */ | |
/* createGenericSchedLive(llvm::MachineSchedContext*) total: 9 9.4e-05 */ | |
/* (anonymous namespace)::MachineScheduler::runOnMachineFunction(llvm::MachineFunction&) total: 19 2.0e-04 */ | |
/* non-virtual thunk to (anonymous namespace)::MachineScheduler::runOnMachineFunction(llvm::MachineFunction&) total: 1 1.0e-05 */ | |
/* (anonymous namespace)::CopyConstrain::apply(llvm::ScheduleDAGInstrs*) total: 85 8.9e-04 */ | |
/* | |
* Total samples for file : "SimplifyLibCalls.cpp" | |
* | |
* 690 0.0072 | |
*/ | |
<credited to line zero> 690 0.0072 : | |
/* bool llvm::CallInst::hasFnAttrImpl<llvm::Attribute::AttrKind>(llvm::Attribute::AttrKind) const [clone .part.310] total: 679 0.0071 */ | |
/* isOnlyUsedInZeroEqualityComparison(llvm::Value*) total: 2 2.1e-05 */ | |
/* llvm::CallInst::getArgOperand(unsigned int) const [clone .constprop.345] total: 3 3.1e-05 */ | |
/* llvm::CallInst::getArgOperand(unsigned int) const [clone .constprop.346] total: 3 3.1e-05 */ | |
/* llvm::CallInst::getArgOperand(unsigned int) const [clone .constprop.347] total: 3 3.1e-05 */ | |
/* | |
* Total samples for file : "LiveDebugVariables.cpp" | |
* | |
* 687 0.0072 | |
*/ | |
<credited to line zero> 687 0.0072 : | |
/* llvm::DenseMap<llvm::MDNode const*, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<llvm::MDNode const*>, llvm::detail::DenseMapPair<llvm::MDNode const*, (anonymous namespace)::UserValue*> >::grow(unsigned int) total: 4 4.2e-05 */ | |
/* llvm::DenseMap<unsigned int, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, (anonymous namespace)::UserValue*> >::grow(unsigned int) total: 2 2.1e-05 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<llvm::MDNode const*, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<llvm::MDNode const*>, llvm::detail::DenseMapPair<llvm::MDNode const*, (anonymous namespace)::UserValue*> >, llvm::MDNode const*, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<llvm::MDNode const*>, llvm::detail::DenseMapPair<llvm::MDNode const*, (anonymous namespace)::UserValue*> >::LookupBucketFor<llvm::MDNode const*>(llvm::MDNode const* const&, llvm::detail::DenseMapPair<llvm::MDNode const*, (anonymous namespace)::UserValue*> const*&) const total: 3 3.1e-05 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<unsigned int, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, (anonymous namespace)::UserValue*> >, unsigned int, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, (anonymous namespace)::UserValue*> >::initEmpty() total: 13 1.4e-04 */ | |
/* bool llvm::DenseMapBase<llvm::DenseMap<unsigned int, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, (anonymous namespace)::UserValue*> >, unsigned int, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, (anonymous namespace)::UserValue*> >::LookupBucketFor<unsigned int>(unsigned int const&, llvm::detail::DenseMapPair<unsigned int, (anonymous namespace)::UserValue*> const*&) const total: 5 5.2e-05 */ | |
/* (anonymous namespace)::LDVImpl::lookupVirtReg(unsigned int) total: 2 2.1e-05 */ | |
/* llvm::IntervalMap<llvm::SlotIndex, unsigned int, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const [clone .isra.267] total: 13 1.4e-04 */ | |
/* llvm::DenseMapBase<llvm::DenseMap<llvm::MDNode const*, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<llvm::MDNode const*>, llvm::detail::DenseMapPair<llvm::MDNode const*, (anonymous namespace)::UserValue*> >, llvm::MDNode const*, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<llvm::MDNode const*>, llvm::detail::DenseMapPair<llvm::MDNode const*, (anonymous namespace)::UserValue*> >::initEmpty() total: 9 9.4e-05 */ | |
/* llvm::detail::DenseMapPair<unsigned int, (anonymous namespace)::UserValue*>* llvm::DenseMapBase<llvm::DenseMap<unsigned int, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, (anonymous namespace)::UserValue*> >, unsigned int, (anonymous namespace)::UserValue*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, (anonymous namespace)::UserValue*> >::InsertIntoBucketImpl<unsigned int>(unsigned int const&, un |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment