c - 如何理解数组中的this指针?

标签 c arrays pointers struct memory-address

int netif_rx(struct sk_buff *skb)
{
struct timeval stamp;
if (skb->stamp.tv_sec == 0)
do_gettimeofday(&skb->stamp);
}

我想获取内核开始执行上述函数的时间,最后我想将它存储在缓冲区skbuf中。如果我像上面那样编码,那么是否可以将调度时间存储在缓冲区中?请有人帮助我吗?我的问题 - 如果我调用 sched_clock();那么它会给出系统的调度时间,但最终如何将其存储在缓冲区中呢?是否可以使用结构指针来存储调度时钟的值?

最佳答案

I want to get the time when which the kernel starts executing the above function and finally I want to store it in a buffer skbuf.

int getsocketschedtime(stuct skbuf *sb)
{
    struct timeval tv;
    gettimeofday(&tv, NULL); 
    sb->tstamp.off_sec = tv.tv_sec;
    sb->tstamp.off_usec = tv.tv_usec;
    // ... do smth useful
}

关于c - 如何理解数组中的this指针?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22983087/

相关文章:

javascript - React - 循环中的项目作为状态中的数组数据 - 重新呈现项目

java - 在 Java 中如何将一个数组的值设置为另一个数组的值?

c - 获取内存地址

c++ - 如何通过指针删除 vector 元素?

c - 从格式未知的文本文件中读取

c - 在 C 中使用加倍方案设置数组值的正确方法?

c - 与线程共享变量的最佳方式

javascript - 使用for循环使用整数序列填充数组,而不会导致Chrome崩溃

c - 递归地在链表末尾插入节点

c - 在 2 个文件 (linux/windows) 版本之间使用 extern 变量