mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
some missing files
This commit is contained in:
parent
61e6cf4f60
commit
699fe68c44
20 changed files with 4284 additions and 0 deletions
35
utility/latency.pike
Normal file
35
utility/latency.pike
Normal file
|
@ -0,0 +1,35 @@
|
|||
# contributed by fippo
|
||||
|
||||
Stdio.File socket;
|
||||
int count;
|
||||
array(int) start, stop;
|
||||
|
||||
void logon(int success) {
|
||||
socket->set_nonblocking(read_cb);
|
||||
socket->write(".\n");
|
||||
}
|
||||
|
||||
void read_cb(int id, string data) {
|
||||
//werror("read_cb:\n%s\n---\n", data);
|
||||
count++;
|
||||
if (count == 2) {
|
||||
start = System.gettimeofday()[..1];
|
||||
socket->write(":_target\tpsyc://localhost/~fippo\n\n_request_version\n.\n");
|
||||
}
|
||||
if (count > 2) {
|
||||
stop = System.gettimeofday()[..1];
|
||||
werror("latency is %d\n", (stop[0] - start[0])*1000000 + (stop[1] - start[1]));
|
||||
if (count < 500) {
|
||||
socket->write(":_target\tpsyc://localhost/\n\n_request_version\n.\n");
|
||||
start = stop;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
socket = Stdio.File();
|
||||
socket->async_connect("localhost", 4404, logon);
|
||||
|
||||
return -1;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue