<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      https://blog.csdn.net/qq_27664167/article/details/82194391

       

      system可以通過(guò)返回值的高8位獲取腳本的返回值

      fork+exec可以根據(jù)wait的入口地址形參獲取腳本的返回值

       

      其使用上需要注意:

      1、 system是阻塞的,wait可以是查詢方式的

      2、system耗時(shí)長(zhǎng),fork+exec+wait耗時(shí)短.

       

      編寫(xiě)程序測(cè)試。

      結(jié)果: 

      parallels@parallels-Parallels-Virtual-Platform:~/Desktop/LinuxC/System$ ./mySystem 
      total time is 1374426 us
      total time is 573213 us
      

        

      測(cè)試代碼:

      #include <stdio.h>
      #include <stdlib.h>
      #include <unistd.h>  
      #include <string.h>
       #include <sys/time.h> 
       #include <sys/types.h>
       #include <sys/wait.h> 
      
      
      int main()
      {
      
          struct timeval start, end;  // define 2 struct timeval variables
      
          gettimeofday(&start, NULL); // get the beginning time
          for(int i=0;i<1000;i++)
          {
              char path[256]={0};
              getcwd(path,256); 
              strcat(path,"/mytest");
              int status = system(path);
              //printf("raw return value=%02X,system return value =%d, shell return value=%d \n",status,WIFEXITED(status),WEXITSTATUS(status)); 
      
              
              getcwd(path,256); 
              strcat(path,"/mytest 102");
              status = system(path);
              //printf("raw return value=%02X,system return value =%d, shell return value=%d \n",status,WIFEXITED(status),WEXITSTATUS(status)); 
      }
      gettimeofday(&end, NULL);  // get the end time
      
      long long total_time = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec); // get the run time by microsecond
      printf("total time is %lld us\n", total_time); 
      
      
      
      gettimeofday(&start, NULL); // get the beginning time
       for(int i=0;i<1000;i++)
       {
           pid_t child_pid = fork();
           if(child_pid<0)
           {
               _exit(0);
           }
           else if(child_pid==0)
           {
               char path[256]={0};
              getcwd(path,256); 
              strcat(path,"/mytest");
               execl(path,"mytest", NULL);
               _exit(0);
           }
           else{
               int status;
               wait(&status);
               //printf("status=%x\n",status);
           }
      
      
           child_pid = fork();
           if(child_pid<0)
           {
               _exit(0);
           }
           else if(child_pid==0)
           {
               char path[256]={0};
              getcwd(path,256); 
              strcat(path,"/mytest");
               execl(path,"mytest","102", NULL);
               _exit(0);
           }
           else{
               int status;
               wait(&status);
               //printf("status=%x\n",status);
           }
       }
      
      gettimeofday(&end, NULL);  // get the end time
      
      total_time = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec); // get the run time by microsecond
      printf("total time is %lld us\n", total_time); 
      
      }
      

        

      #include <stdio.h>
      #include <stdlib.h>
      
      int main(int argc, char** argv)
      {
          if(argc==1)return 100;
          else return atoi(argv[1]);
      
      }
      

        

       

      posted on 2022-02-20 12:03  Muniar  閱讀(69)  評(píng)論(0)    收藏  舉報(bào)

      主站蜘蛛池模板: 亚洲国产精品人人做人人爱| 国产精品自在线拍国产手机版| 久久综合色一综合色88| 亚洲欧美牲交| 三上悠亚精品一区二区久久| 亚洲精品香蕉一区二区| 国产精品国三级国产av| 他掀开裙子把舌头伸进去添视频| 国产一区二区精品久久呦| 国产超高清麻豆精品传媒麻豆精品| 峨山| 亚洲午夜理论无码电影| 四虎成人精品国产永久免费| 久久青青草原亚洲AV无码麻豆| 亚洲啪啪精品一区二区的| 九九re线精品视频在线观看视频| 国产在线观看播放av| 亚洲最大成人av在线天堂网| 亚洲色大成网站www在线| 国产女高清在线看免费观看| 无码精品人妻一区二区三区中| 亚洲最大成人av在线天堂网| 亚洲精品麻豆一二三区| 高颜值午夜福利在线观看| 色又黄又爽18禁免费网站现观看| 国产综合色在线精品| 欧美成人精品在线| 蜜臀一区二区三区精品免费| 国产成A人片在线观看视频下载| 滨州市| 久久综合开心激情五月天| 九九热免费精品视频在线| 亚洲一区二区三区四区| 国产精品免费中文字幕| 女同在线观看亚洲国产精品| 久久96热在精品国产高清| 久久国产乱子伦免费精品无码 | 猫咪AV成人永久网站在线观看 | 国产精品日韩av一区二区| 免费av网站| 1024你懂的国产精品|