g_timer:assertion `timer != NULL' failed ?



Hi,
Thanks to Jean Bréfort <jean brefort free fr> and Jan-Marek Glogowski <glogow fbihome de> 's help,my problem about how to manipulate utf-8 text is fixed .

Now I encount a problem about g_timer .
test code 1:
--------------------------------------------------
#include <glib.h>
#include <stdio.h>

#define _MAX  100000

int main()
{

  glong microsec ;
  gdouble sec ;
  GTimer  * timer;
  g_timer_start (timer) ;
  long i ;
  for (  i=0 ;i < _MAX ; i++ ) { }
  g_timer_stop(timer);
  sec = g_timer_elapsed(timer,&microsec) ;
  g_printf("The time is %f second ,%d microsecond\n",sec,microsec );

}

--------------------------------------------------
[flamingo openarch flamingo]$gcc -g test_timer-3.c -o tt3.bin `pkg-config --cflags --libs glib-2.0`
[flamingo openarch flamingo]$gdb tt3.bin
(gdb)r
Starting program: /home/flamingo/tt3.bin 
The time is 0.000238 second ,238 microsecond

Program received signal SIGSEGV, Segmentation fault.
0x4000c660 in _dl_fini () from /lib/ld-linux.so.2

test code 2 :
--------------------------------------------------
#include <glib.h>
#include <stdio.h>
#define _MAX  1000000000
GTimer  * timer;
int main()
{

  glong microsec ;
  gdouble sec ;
  g_timer_start (timer) ;
  long i ;
  for (  i=0 ;i < _MAX ; i++ ) {}
  g_timer_stop(timer);
  sec = g_timer_elapsed(timer,&microsec) ;
  g_printf("The time is %f second ,%d microsecond\n",sec,microsec );

}
--------------------------------------------------
[flamingo openarch flamingo]$gcc -g test_timer-1.c -o tt1.bin `pkg-config --cflags --libs glib-2.0`
[flamingo openarch flamingo]$ ./tt1.bin 

(process:4290): GLib-CRITICAL **: file gtimer.c: line 96 (g_timer_start): assertion `timer != NULL' failed

(process:4290): GLib-CRITICAL **: file gtimer.c: line 106 (g_timer_stop): assertion `timer != NULL' failed

(process:4290): GLib-CRITICAL **: file gtimer.c: line 130 (g_timer_elapsed): assertion `timer != NULL' failed
The time is 0.000000 second ,1073828704 microsecond
--------------------------------------------------

I am really missed by this .Could anyone give me some suggestions ?






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]