egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

measure the lag bot

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat Apr 04, 2015 10:11 pm    Post subject: measure the lag bot Reply with quote

I need a command to measure the lag of the bot every 10 minutes automatically.

Code:

set adminchan "#adminchan"
bind time - "?0 * * * *" lagbot

proc lagbot { } {
global adminchan
putmsg $adminchan "Bot  lag is...... seconds"
}
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sat Apr 04, 2015 11:14 pm    Post subject: Re: measure the lag bot Reply with quote

juanamores wrote:
I need a command to measure the lag of the bot every 10 minutes automatically.
...


Please define "the lag of the bot" for us.


In the meantime, and assuming that you are working on this yourself - if you need a way to have the bot ping somebody, then something like this will send out the ping request:
Code:

putserv "privmsg NickToPing_here :\001PING [clock milliseconds]\001"


Then you could watch for the return.
Look up the
ctcr
bind, in tcl-commands.doc .

You could do some math with expr, and if you kept the time that the ping was sent out - subtract the time that it came back.
Would that be what you are looking for?

I hope some of this helps you to piece together something.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sun Apr 05, 2015 12:39 am    Post subject: Re: measure the lag bot Reply with quote

willyw wrote:
Please define "the lag of the bot" for us.


Defined as the time after which the bot will respond to a command from any user (not a specific user).
I mean, what I need is that the measure Bot its own lag, with respect to any potential user who will use it.

Example:

My bot inform me #adminchan channel your lag is 30 seconds.
12:00:00 @Mybot ¦ My lag is 30 seconds
This would mean that my bot will take 30 seconds to answer a command of any user who uses it.

12:00:00 userx ¦ !hello
12:00:30 @Mybot ¦ hello userx
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sun Apr 05, 2015 8:38 am    Post subject: Re: measure the lag bot Reply with quote

juanamores wrote:

...
Defined as the time after which the bot will respond to a command from any user (not a specific user).
I mean, what I need is that the measure Bot its own lag, with respect to any potential user who will use it.
...


I'm thinking that having the bot ping the user, then report the ping response time is what you are wanting. Please tell me, if this is incorrect.

Some time ago, I wrote myself a script to do just that because the bot is a trivia game bot, and sometimes users just get the feeling that they have a "laggy" connection and others are getting ahead of them. Smile
So, I created a way for them to have the bot ping them, and report.

I used the ideas that I gave you above.
Have you had any time to write some of it for yourself yet, using those ideas? Post what you have, here. All of it. Then we can try to help you with it.

If this is totally new to you, you need to say so now. Your first post included some code, so it appears that you do know some basic tcl already, therefore that is how you will be treated. That will frustrate you, if you know no tcl at all. So, let us know. Smile
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sun Apr 05, 2015 9:38 am    Post subject: Re: measure the lag bot Reply with quote

willyw wrote:

I'm thinking that having the bot ping the user, then report the ping response time is what you are wanting. Please tell me, if this is incorrect.
.....
If this is totally new to you, you need to say so now. Your first post included some code, so it appears that you do know some basic tcl already, therefore that is how you will be treated. That will frustrate you, if you know no tcl at all. So, let us know. Smile


I'm just starting to learn TCL, I know very little this it.
One idea might be, a code that ping 5 random users any of the channels where the bot is.

Then make an average in seconds responses of the 5 ping and save the result in a variable.
It is possible?
Sorry for my bad English and very grateful for your kindness in answering.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sun Apr 05, 2015 12:27 pm    Post subject: Re: measure the lag bot Reply with quote

juanamores wrote:

...
I'm just starting to learn TCL, I know very little this it.


Excellent! Smile I hope you continue to learn TCL, and have fun with it.

Quote:

One idea might be, a code that ping 5 random users any of the channels where the bot is.


You might want to reconsider this. Is it possible that the users would soon get tired of being pinged?

Or at least wonder why they are being pinged?

Perhaps it should ping just one user, and let that user be ... you.


Quote:

Then make an average in seconds responses of the 5 ping and save the result in a variable.
It is possible?


Yes - if you want to learn the basics.

However - again - you might want to reconsider your plan. Of what use will this information really be?
Just because it is possible does not mean that it will be meaningful.

Ping response times can vary for a lot of different reasons. And those reasons can change, and do.

I don't know what you need this info for. But is it possible that it would be more meaningful if it was current? That's what I found, and do. The user can have the bot ping himself, when he wants to.

It is up to you. Smile

Quote:

Sorry for my bad English ...


Your English is fine. Don't worry. Smile

Since this is new to you, here are a few links that will help you:

http://suninet.the-demon.de/
A great place to get started learning.

http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html
The Eggdrop related TCL commands.

http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm
The rest of TCL commands.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sun Apr 05, 2015 12:33 pm    Post subject: Re: measure the lag bot Reply with quote

Have you experimented with this line that I posted earlier, yet?

Code:

putserv "privmsg NickToPing_here :\001PING [clock milliseconds]\001"


That will make the bot send a ping request to whatever nick you substitute in for NickToPing_here .

To make the bot watch for the return, go to:
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html
and text search for:
bind ctcr
and read about that bind.

Quote:

bind ctcr <flags> <keyword> <proc>
proc-name <nick> <user@host> <handle> <dest> <keyword> <text>

Description: just like ctcp, but this is triggered for a ctcp-reply (ctcp embedded in a notice instead of a privmsg)


Write a proc to correspond to a
bind ctcr
and you can capture the text returned.
Examine that text, and see if you can do anything with it. Smile

Post your code here.
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sun Apr 05, 2015 1:48 pm    Post subject: Reply with quote

It would help to have a clearer understanding of exactly what irc lag is.
Please read this page, as I believe it puts the whole thing into perspective, http://www.ircbeginner.com/ircinfo/h-lag.html
The key fact to gather from that explanation is...
Quote:
No one is ever really lagged themselves; they are only lagged to each other.
...and that 'lag' is specific to Only Those 2 Users, and no one else.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sun Apr 05, 2015 9:44 pm    Post subject: Reply with quote

Thanks to willyw for their ideas and Spike ^^ for clearing the concept of 'lag'.

I am modifying a shoucast.tcl and it took him well into him I'm just adding some details that are not essential.

This idea of ​​measuring the lag own bot, I saw another bot, which realizing you a status, returned by a canal a figure of lag.

Sometimes the bot does not answer to anyone, not just to a particular user, delay in responding to all, so I thought it might be a lag own bot with respect to all users.

But with explanations of Spike ^^ I see is just an optical illusion Smile

Thank you so much to you both for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber