All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cansniffer: totally untested hack to reduce display update by factor of 10
@ 2014-06-24 16:26 Marc Kleine-Budde
  2014-06-24 16:38 ` Oliver Hartkopp
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2014-06-24 16:26 UTC (permalink / raw)
  To: felix.seitz; +Cc: linux-can, socketcan, Marc Kleine-Budde

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
changes since v2:
- fix factors in usage text

 cansniffer.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/cansniffer.c b/cansniffer.c
index c8ee58e..f7f5424 100644
--- a/cansniffer.c
+++ b/cansniffer.c
@@ -86,9 +86,9 @@
 
 /* time defaults */
 
-#define TIMEOUT 50 /* in 100ms */
-#define HOLD    10 /* in 100ms */
-#define LOOP     2 /* in 100ms */
+#define TIMEOUT 500 /* in 10ms */
+#define HOLD    100 /* in 10ms */
+#define LOOP      2 /* in 10ms */
 
 #define MAXANI 8
 const char anichar[MAXANI] = {'|', '/', '-', '\\', '|', '/', '-', '\\'};
@@ -172,9 +172,9 @@ void print_usage(char *prg)
 	fprintf(stderr, "         -B         (start with binary mode with gap - exceeds 80 chars!)\n");
 	fprintf(stderr, "         -c         (color changes)\n");
 	fprintf(stderr, "         -f         (filter on CAN-ID only)\n");
-	fprintf(stderr, "         -t <time>  (timeout for ID display [x100ms] default: %d, 0 = OFF)\n", TIMEOUT);
-	fprintf(stderr, "         -h <time>  (hold marker on changes [x100ms] default: %d)\n", HOLD);
-	fprintf(stderr, "         -l <time>  (loop time (display) [x100ms] default: %d)\n", LOOP);
+	fprintf(stderr, "         -t <time>  (timeout for ID display [x10ms] default: %d, 0 = OFF)\n", TIMEOUT);
+	fprintf(stderr, "         -h <time>  (hold marker on changes [x10ms] default: %d)\n", HOLD);
+	fprintf(stderr, "         -l <time>  (loop time (display) [x10ms] default: %d)\n", LOOP);
 	fprintf(stderr, "Use interface name '%s' to receive from all can-interfaces\n", ANYDEV);
 	fprintf(stderr, "\n");
 	fprintf(stderr, "%s", manual);
@@ -329,7 +329,7 @@ int main(int argc, char **argv)
 		FD_SET(s, &rdfs);
 
 		timeo.tv_sec  = 0;
-		timeo.tv_usec = 100000 * loop;
+		timeo.tv_usec = 10000 * loop;
 
 		if ((ret = select(s+1, &rdfs, NULL, NULL, &timeo)) < 0) {
 			//perror("select");
@@ -338,7 +338,7 @@ int main(int argc, char **argv)
 		}
 
 		gettimeofday(&tv, NULL);
-		currcms = (tv.tv_sec - start_tv.tv_sec) * 10 + (tv.tv_usec / 100000);
+		currcms = (tv.tv_sec - start_tv.tv_sec) * 100 + (tv.tv_usec / 10000);
 
 		if (FD_ISSET(0, &rdfs))
 			running &= handle_keyb(s);
-- 
2.0.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] cansniffer: totally untested hack to reduce display update by factor of 10
  2014-06-24 16:26 [PATCH v2] cansniffer: totally untested hack to reduce display update by factor of 10 Marc Kleine-Budde
@ 2014-06-24 16:38 ` Oliver Hartkopp
  2014-06-24 16:44   ` Marc Kleine-Budde
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Hartkopp @ 2014-06-24 16:38 UTC (permalink / raw)
  To: Marc Kleine-Budde, felix.seitz; +Cc: linux-can

I'll check it and give a feedback.

Btw. it needs a v3:

>  /* time defaults */
>  
> -#define TIMEOUT 50 /* in 100ms */
> -#define HOLD    10 /* in 100ms */
> -#define LOOP     2 /* in 100ms */
> +#define TIMEOUT 500 /* in 10ms */
> +#define HOLD    100 /* in 10ms */
> +#define LOOP      2 /* in 10ms */

LOOP has to be *10 too.

Regards,
Oliver


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] cansniffer: totally untested hack to reduce display update by factor of 10
  2014-06-24 16:38 ` Oliver Hartkopp
@ 2014-06-24 16:44   ` Marc Kleine-Budde
  2014-06-24 17:51     ` Oliver Hartkopp
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2014-06-24 16:44 UTC (permalink / raw)
  To: Oliver Hartkopp, felix.seitz; +Cc: linux-can



On 24 June 2014 18:38:06 CEST, Oliver Hartkopp <socketcan@hartkopp.net> wrote:
>I'll check it and give a feedback.
>
>Btw. it needs a v3:
>
>>  /* time defaults */
>>  
>> -#define TIMEOUT 50 /* in 100ms */
>> -#define HOLD    10 /* in 100ms */
>> -#define LOOP     2 /* in 100ms */
>> +#define TIMEOUT 500 /* in 10ms */
>> +#define HOLD    100 /* in 10ms */
>> +#define LOOP      2 /* in 10ms */
>
>LOOP has to be *10 too.

Yes, if we want unchanged behaviour, which would be better for mainlining. With my patch the default is now 20ms. 

Marc

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] cansniffer: totally untested hack to reduce display update by factor of 10
  2014-06-24 16:44   ` Marc Kleine-Budde
@ 2014-06-24 17:51     ` Oliver Hartkopp
  2014-06-24 18:09       ` Felix Seitz
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Hartkopp @ 2014-06-24 17:51 UTC (permalink / raw)
  To: Marc Kleine-Budde, felix.seitz; +Cc: linux-can

Ok, it IS faster (and will therefore help Felix).

But the tiny animation is broken now.

I probably have to rework the animation - will send an updated patch.

Thanks for your support,
Oliver

On 24.06.2014 18:44, Marc Kleine-Budde wrote:
> 
> 
> On 24 June 2014 18:38:06 CEST, Oliver Hartkopp <socketcan@hartkopp.net> wrote:
>> I'll check it and give a feedback.
>>
>> Btw. it needs a v3:
>>
>>>  /* time defaults */
>>>  
>>> -#define TIMEOUT 50 /* in 100ms */
>>> -#define HOLD    10 /* in 100ms */
>>> -#define LOOP     2 /* in 100ms */
>>> +#define TIMEOUT 500 /* in 10ms */
>>> +#define HOLD    100 /* in 10ms */
>>> +#define LOOP      2 /* in 10ms */
>>
>> LOOP has to be *10 too.
> 
> Yes, if we want unchanged behaviour, which would be better for mainlining. With my patch the default is now 20ms. 
> 
> Marc
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] cansniffer: totally untested hack to reduce display update by factor of 10
  2014-06-24 17:51     ` Oliver Hartkopp
@ 2014-06-24 18:09       ` Felix Seitz
  0 siblings, 0 replies; 5+ messages in thread
From: Felix Seitz @ 2014-06-24 18:09 UTC (permalink / raw)
  To: Oliver Hartkopp, Marc Kleine-Budde; +Cc: linux-can

Hi Marc and Oliver,

thank you both for your quick help. I will try this out tomorrow.

Regards,
Felix


Am 24.06.2014 19:51, schrieb Oliver Hartkopp:
> Ok, it IS faster (and will therefore help Felix).
>
> But the tiny animation is broken now.
>
> I probably have to rework the animation - will send an updated patch.
>
> Thanks for your support,
> Oliver
>
> On 24.06.2014 18:44, Marc Kleine-Budde wrote:
>>
>> On 24 June 2014 18:38:06 CEST, Oliver Hartkopp <socketcan@hartkopp.net> wrote:
>>> I'll check it and give a feedback.
>>>
>>> Btw. it needs a v3:
>>>
>>>>   /* time defaults */
>>>>   
>>>> -#define TIMEOUT 50 /* in 100ms */
>>>> -#define HOLD    10 /* in 100ms */
>>>> -#define LOOP     2 /* in 100ms */
>>>> +#define TIMEOUT 500 /* in 10ms */
>>>> +#define HOLD    100 /* in 10ms */
>>>> +#define LOOP      2 /* in 10ms */
>>> LOOP has to be *10 too.
>> Yes, if we want unchanged behaviour, which would be better for mainlining. With my patch the default is now 20ms.
>>
>> Marc
>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-24 18:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-24 16:26 [PATCH v2] cansniffer: totally untested hack to reduce display update by factor of 10 Marc Kleine-Budde
2014-06-24 16:38 ` Oliver Hartkopp
2014-06-24 16:44   ` Marc Kleine-Budde
2014-06-24 17:51     ` Oliver Hartkopp
2014-06-24 18:09       ` Felix Seitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.