示例代码:
#include <stdio.h>
#include <unistd.h>
#include <sched.h>
#include <pthread.h>
int
main (int argc, char **argv)
{
unsigned char buffer[128];
char buf[0x4000];
setvbuf (stdout, buf, _IOFBF, 0x4000);
fork ();
fork ();
pthread_t this_thread = pthread_self ();
struct sched_param params;
params.sched_priority = sched_get_priority_max (SCHED_RR);
pthread_setschedparam (this_thread, SCHED_RR, ¶ms);
while (1)
{
fwrite (&buffer, 128, 1, stdout);
}
}
Run Code Online (Sandbox Code Playgroud)
该程序打开 4 个线程,并在 stdout 上输出“buffer”的内容,该内容在 64 位 cpu 上为 128 字节或 16 个长整型。
如果我然后运行:
./写测试| pv -ptebaSs 800G >/dev/null
我得到的速度约为 7.5 GB/s。
顺便说一句,如果我这样做的话,这与我得到的速度是一样的:
$ …
Run Code Online (Sandbox Code Playgroud) 我需要一个以这种方式完成的原型:
Array.prototype.getname=function(){ [...]return arrayname; }
Run Code Online (Sandbox Code Playgroud)
所以我可以:
z=new Array;
alert(z.name);
Run Code Online (Sandbox Code Playgroud)
我应该在警报中有“z”。
我在 Chrome 上工作,来电者/被调用者似乎返回空。
如果我这样做:
Object.defineProperty(window, 'hello',{
get: ()=>"hello to you!"
});
Run Code Online (Sandbox Code Playgroud)
其调用方式为:
你好
并向您回复您好!我该如何删除它?