DirectFB压力测试工具[2]

发表于:2010-02-20来源:作者:点击数: 标签:工具DirectFB压力
DirectFB压力 测试工具 [2] 压力测试 事件重放函数: static gboolean replay_one_event (gpointer user_data) ...{ DFBContext *context = (DFBContext*)user_data; off_t cur = 0; DFBInputEvent event = context-event; if(event.type == DIET_KEYPRESS ||

  DirectFB压力测试工具[2]  压力测试 

     事件重放函数:

  static gboolean replay_one_event (gpointer user_data)

  ...{

  DFBContext *context = (DFBContext*)user_data;

  off_t cur = 0;

  DFBInputEvent event = context->event;

  if(event.type == DIET_KEYPRESS || event.type == DIET_KEYRELEASE)

  ...{

  dfb_input_dispatch (context->keyboard_device, &event);

  }

  else

  ...{

  dfb_input_dispatch (context->mouse_device, &event);

  }

  if (fread (&context->event, sizeof (DFBInputEvent), 1, context->file) == 1)

  ...{

  guint ms = (context->event.timestamp.tv_sec - event.timestamp.tv_sec) * 1000

  + (context->event.timestamp.tv_usec - event.timestamp.tv_usec)/1000;

  g_timeout_add (ms, replay_one_event, user_data);  软件测试  }

  else

  ...{

  g_main_loop_quit (context->loop);

  }

  return FALSE;

  }

  注意:DirectFB中的笔点事件是以相对坐标方式表示的,所以要保证重放时光标在同样的初始位置。如果DirectFB以多进程的方式运行,这个程序可以是一个独立的进程,否则要放到应用程序的进程中才行。

原文转自:http://www.ltesting.net