免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2358 | 回复: 2
打印 上一主题 下一主题

[数据结构] 关于rb_buffer_peek()的一个疑问。。。 [复制链接]

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-01-20 09:56 |只看该作者 |倒序浏览
20可用积分
本帖最后由 chishanmingshen 于 2013-02-28 00:09 编辑


from 3.7.0


  1. static struct ring_buffer_event *
  2. rb_buffer_peek(struct ring_buffer_per_cpu *cpu_buffer, u64 *ts,
  3.                unsigned long *lost_events)
  4. {
  5.         struct ring_buffer_event *event;
  6.         struct buffer_page *reader;
  7.         int nr_loops = 0;

  8. again:
  9.         /*
  10.          * We repeat when a time extend is encountered.
  11.          * Since the time extend is always attached to a data event,
  12.          * we should never loop more than once.
  13.          * (We never hit the following condition more than twice).
  14.          */
  15.         if (RB_WARN_ON(cpu_buffer, ++nr_loops > 2))<------------------此处是2,老的版本是3!
  16.                 return NULL;

  17.         reader = rb_get_reader_page(cpu_buffer);
  18.         if (!reader)
  19.                 return NULL;

  20.         event = rb_reader_event(cpu_buffer);

  21.         switch (event->type_len) {
  22.         case RINGBUF_TYPE_PADDING:
  23.                 if (rb_null_event(event))
  24.                         RB_WARN_ON(cpu_buffer, 1);
  25.                 /*
  26.                  * Because the writer could be discarding every
  27.                  * event it creates (which would probably be bad)
  28.                  * if we were to go back to "again" then we may never
  29.                  * catch up, and will trigger the warn on, or lock
  30.                  * the box. Return the padding, and we will release
  31.                  * the current locks, and try again.
  32.                  */
  33.                 return event;

  34.         case RINGBUF_TYPE_TIME_EXTEND:
  35.                 /* Internal data, OK to advance */
  36.                 rb_advance_reader(cpu_buffer);
  37.                 goto again;

  38.         case RINGBUF_TYPE_TIME_STAMP:
  39.                 /* FIXME: not implemented */
  40.                 rb_advance_reader(cpu_buffer);
  41.                 goto again;

  42.         case RINGBUF_TYPE_DATA:
  43.                 if (ts) {
  44.                         *ts = cpu_buffer->read_stamp + event->time_delta;
  45.                         ring_buffer_normalize_time_stamp(cpu_buffer->buffer,
  46.                                                          cpu_buffer->cpu, ts);
  47.                 }
  48.                 if (lost_events)
  49.                         *lost_events = rb_lost_events(cpu_buffer);
  50.                 return event;

  51.         default:
  52.                 BUG();
  53.         }

  54.         return NULL;
  55. }

复制代码
版本之间有些差异,奇怪。。。

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2013-02-27 21:50 |只看该作者
本帖最后由 chishanmingshen 于 2013-02-28 00:10 编辑

有清楚这个的,请指点一下,谢谢!

论坛徽章:
0
3 [报告]
发表于 2013-03-01 13:57 |只看该作者
兄弟,你试试这个命令呢?
git log Path/File | grep ^commit | cut -d" " -f2 | xargs git show

希望能有用。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP