Comments (4)
Thx, I found
turmoil::elapsed()
, it works as alternatives ofnow()
. But when I want tosleep(duration)
, without an mock API liketurmoil:sleep()
, how do I sleep a logical duration rather than realistic duration ?
tokio::time::sleep
works on logical time as each host's runtime is paused.
See: https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html#method.start_paused
See: https://github.com/tokio-rs/turmoil/blob/main/src/rt.rs#L112
from turmoil.
For 1. you've got the rng and epoch setup correctly, but unfortunately we aren't tied tightly into tokio yet for Instant
to work, note you are using std::time
not tokio::time
as well. The tokio Instant's elapsed() will work correctly, and we also expose the total elapsed()
time in each host for building more accurate simulated clocks across host restarts.
For 2. we haven't built IO yet, but that is something we'd like to include: #15
from turmoil.
For 1. you've got the rng and epoch setup correctly, but unfortunately we aren't tied tightly into tokio yet for
Instant
to work, note you are usingstd::time
nottokio::time
as well. The tokio Instant's elapsed() will work correctly, and we also expose the totalelapsed()
time in each host for building more accurate simulated clocks across host restarts.
Thx, I found turmoil::elapsed()
, it works as alternatives of now()
. But when I want to sleep(duration)
, without an mock API like turmoil:sleep()
, how do I sleep a logical duration rather than realistic duration ?
from turmoil.
Good !
from turmoil.
Related Issues (20)
- Re-starting a crashed host with bounce panics
- More interesting examples of testing distribution system building blocks HOT 3
- support ephemeral port assignments HOT 1
- Implement additional UDP features HOT 1
- Fix AsyncRead impl for TcpStream
- Regex matching throws exception in Pair
- meets Tokio `enble_io()` error HOT 4
- Return errors instead of panicking, when sending invalid packets. HOT 2
- Support multiple network interfaces HOT 8
- Loopback is incomplete
- Error `ConnectionRefused` when binding UdpSocket to `localhost` HOT 2
- Spawn blocking blocking sim runtime HOT 1
- Infinitely running. HOT 2
- Fix socket close behavior when there is unread data
- Add support for SO_LINGER to `TcpStream`
- Add warning for blocking tasks that block the sim
- Support one-way partitions
- Enable testing of backpressure from TCP connections HOT 2
- Network partition should cause 'host unreachable' not 'connection refused' for TCP HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turmoil.