How to get CPU and memory usage in C? (in Linux System)Calculating total CPU system usage in CPeriodically...

What are the peak hours for public transportation in Paris?

How would a aircraft visually signal "in distress"?

Inconsistent behavior of compiler optimization of unused string

Why would future John risk sending back a T-800 to save his younger self?

Was there a priest on the Titanic who stayed on the ship giving confession to as many as he could?

Genetic limitations to learn certain instruments

What ways have you found to get edits from non-LaTeX users?

Implement Homestuck's Catenative Doomsday Dice Cascader

What's up with this leaf?

Is counterpoint still used today?

What makes an item an artifact?

Confusion about off peak timings of London trains

Is the term 'open source' a trademark?

How to generate all commutative pairings of list elements?

Find the Factorial From the Given Prime Relationship

At what point in time did Dumbledore ask Snape for this favor?

Why was the Sega Genesis marketed as a 16-bit console?

Using "subway" as name for London Underground?

What's the name of this light airplane?

Preventing Employees from either switching to Competitors or Opening Their Own Business

PhD - Well known professor or well known school?

Using a special key in function

Why doesn't Adrian Toomes give up Spider-Man's identity?

How to retract an idea already pitched to an employer?



How to get CPU and memory usage in C? (in Linux System)


Calculating total CPU system usage in CPeriodically get CPU usage for single processWhy does my cpu never get past 60-70% cpu usage? Where is the bottleneck?Limit CPU and Memory usage for C, Java programs at system levelGet separate user, system, etc CPU usage per processCPU usage: user,system,idle always add up to 100%?Best way to get precise measure max memory usage and cpu timeHow can I get CPU overall usage and individual core usage information just once?setroubleshootd excessive cpu and memory usageHow to get CPU usage in MySQL per user?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I wrote a C program is about vigenere encrypt and decode.
And then, I want to add CPU and Memory usage in this program.



However, I don't know what to add CPU and Memory code in this program.
※I just want to know CPU and Memory usage in this program.
I hope everyone can help me. Thanks!!



The following code is my C program of vigenere encrypt and decode



#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <omp.h>

int char_to_index(char c)
{
/*if(c>='A' && c<='Z'){
c=c+32;
}*/
char x = c;
char result = x - 'a';
return (int)result;
}

char index_to_char(int c)
{
int result = c + 97;
return (char)result;
}

char * xorencrypt(char * message, char * key) {
int i;
size_t messagelen = strlen(message);
size_t keylen = strlen(key);

char * encrypted = malloc(messagelen+1);
//start to parallel
omp_set_num_threads(8);
#pragma omp parallel
private(i)
#pragma omp for
for (i = 0; i < messagelen; i++) {
int buf1 = char_to_index(message[i]);
int buf2 = char_to_index(key[i % keylen]);
char r = index_to_char(buf1 ^ buf2);
encrypted[i] = r;
}

encrypted[messagelen] = '';

return encrypted;
}

char * xordecode(char * cript, char * key) {
int i;
size_t criptlen = strlen(cript);
size_t keylen = strlen(key);

char * message = malloc(criptlen+1);
//start to parallel
omp_set_num_threads(8);
#pragma omp parallel
private(i)
#pragma omp for
for (i = 0; i < criptlen; i++) {
int buf1 = char_to_index(cript[i]);
int buf2 = char_to_index(key[i % keylen]);
char r = index_to_char(buf1 ^ buf2);
message[i] = r;
}

message[criptlen] = '';

return message;
}

int time_substract(struct timeval *result, struct timeval *begin,struct timeval *end)
{
if(begin->tv_sec > end->tv_sec) return -1;
if((begin->tv_sec == end->tv_sec) && (begin->tv_usec > end->tv_usec)) return -2;
result->tv_sec = (end->tv_sec - begin->tv_sec);
result->tv_usec = (end->tv_usec - begin->tv_usec);

if(result->tv_usec < 0)
{
result->tv_sec--;
result->tv_usec += 1000000;
}
return 0;
}

int main(int argc, const char * argv[]) {
//count time!!!
struct timeval start,stop,diff;
memset(&start,0,sizeof(struct timeval));
memset(&stop,0,sizeof(struct timeval));
memset(&diff,0,sizeof(struct timeval));
gettimeofday(&start,0);
//count time!!!

char * message = "By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. ";
printf("Input : %sn",message);
char * key = "key";

char * encrypted = xorencrypt(message, key);
printf("Encrypted: %sn", encrypted);

char * message1 = xordecode(encrypted, key);
printf("Decrypted: %sn", message1);

//count time!!!
gettimeofday(&stop,0);
time_substract(&diff,&start,&stop);
printf("Total time : %d s,%d usn",(int)diff.tv_sec,(int)diff.tv_usec);
//count time!!!
return 0;
}









share|improve this question







New contributor



Cyrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    0















    I wrote a C program is about vigenere encrypt and decode.
    And then, I want to add CPU and Memory usage in this program.



    However, I don't know what to add CPU and Memory code in this program.
    ※I just want to know CPU and Memory usage in this program.
    I hope everyone can help me. Thanks!!



    The following code is my C program of vigenere encrypt and decode



    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <sys/time.h>
    #include <omp.h>

    int char_to_index(char c)
    {
    /*if(c>='A' && c<='Z'){
    c=c+32;
    }*/
    char x = c;
    char result = x - 'a';
    return (int)result;
    }

    char index_to_char(int c)
    {
    int result = c + 97;
    return (char)result;
    }

    char * xorencrypt(char * message, char * key) {
    int i;
    size_t messagelen = strlen(message);
    size_t keylen = strlen(key);

    char * encrypted = malloc(messagelen+1);
    //start to parallel
    omp_set_num_threads(8);
    #pragma omp parallel
    private(i)
    #pragma omp for
    for (i = 0; i < messagelen; i++) {
    int buf1 = char_to_index(message[i]);
    int buf2 = char_to_index(key[i % keylen]);
    char r = index_to_char(buf1 ^ buf2);
    encrypted[i] = r;
    }

    encrypted[messagelen] = '';

    return encrypted;
    }

    char * xordecode(char * cript, char * key) {
    int i;
    size_t criptlen = strlen(cript);
    size_t keylen = strlen(key);

    char * message = malloc(criptlen+1);
    //start to parallel
    omp_set_num_threads(8);
    #pragma omp parallel
    private(i)
    #pragma omp for
    for (i = 0; i < criptlen; i++) {
    int buf1 = char_to_index(cript[i]);
    int buf2 = char_to_index(key[i % keylen]);
    char r = index_to_char(buf1 ^ buf2);
    message[i] = r;
    }

    message[criptlen] = '';

    return message;
    }

    int time_substract(struct timeval *result, struct timeval *begin,struct timeval *end)
    {
    if(begin->tv_sec > end->tv_sec) return -1;
    if((begin->tv_sec == end->tv_sec) && (begin->tv_usec > end->tv_usec)) return -2;
    result->tv_sec = (end->tv_sec - begin->tv_sec);
    result->tv_usec = (end->tv_usec - begin->tv_usec);

    if(result->tv_usec < 0)
    {
    result->tv_sec--;
    result->tv_usec += 1000000;
    }
    return 0;
    }

    int main(int argc, const char * argv[]) {
    //count time!!!
    struct timeval start,stop,diff;
    memset(&start,0,sizeof(struct timeval));
    memset(&stop,0,sizeof(struct timeval));
    memset(&diff,0,sizeof(struct timeval));
    gettimeofday(&start,0);
    //count time!!!

    char * message = "By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. ";
    printf("Input : %sn",message);
    char * key = "key";

    char * encrypted = xorencrypt(message, key);
    printf("Encrypted: %sn", encrypted);

    char * message1 = xordecode(encrypted, key);
    printf("Decrypted: %sn", message1);

    //count time!!!
    gettimeofday(&stop,0);
    time_substract(&diff,&start,&stop);
    printf("Total time : %d s,%d usn",(int)diff.tv_sec,(int)diff.tv_usec);
    //count time!!!
    return 0;
    }









    share|improve this question







    New contributor



    Cyrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      I wrote a C program is about vigenere encrypt and decode.
      And then, I want to add CPU and Memory usage in this program.



      However, I don't know what to add CPU and Memory code in this program.
      ※I just want to know CPU and Memory usage in this program.
      I hope everyone can help me. Thanks!!



      The following code is my C program of vigenere encrypt and decode



      #include <stdio.h>
      #include <stdlib.h>
      #include <string.h>
      #include <sys/time.h>
      #include <omp.h>

      int char_to_index(char c)
      {
      /*if(c>='A' && c<='Z'){
      c=c+32;
      }*/
      char x = c;
      char result = x - 'a';
      return (int)result;
      }

      char index_to_char(int c)
      {
      int result = c + 97;
      return (char)result;
      }

      char * xorencrypt(char * message, char * key) {
      int i;
      size_t messagelen = strlen(message);
      size_t keylen = strlen(key);

      char * encrypted = malloc(messagelen+1);
      //start to parallel
      omp_set_num_threads(8);
      #pragma omp parallel
      private(i)
      #pragma omp for
      for (i = 0; i < messagelen; i++) {
      int buf1 = char_to_index(message[i]);
      int buf2 = char_to_index(key[i % keylen]);
      char r = index_to_char(buf1 ^ buf2);
      encrypted[i] = r;
      }

      encrypted[messagelen] = '';

      return encrypted;
      }

      char * xordecode(char * cript, char * key) {
      int i;
      size_t criptlen = strlen(cript);
      size_t keylen = strlen(key);

      char * message = malloc(criptlen+1);
      //start to parallel
      omp_set_num_threads(8);
      #pragma omp parallel
      private(i)
      #pragma omp for
      for (i = 0; i < criptlen; i++) {
      int buf1 = char_to_index(cript[i]);
      int buf2 = char_to_index(key[i % keylen]);
      char r = index_to_char(buf1 ^ buf2);
      message[i] = r;
      }

      message[criptlen] = '';

      return message;
      }

      int time_substract(struct timeval *result, struct timeval *begin,struct timeval *end)
      {
      if(begin->tv_sec > end->tv_sec) return -1;
      if((begin->tv_sec == end->tv_sec) && (begin->tv_usec > end->tv_usec)) return -2;
      result->tv_sec = (end->tv_sec - begin->tv_sec);
      result->tv_usec = (end->tv_usec - begin->tv_usec);

      if(result->tv_usec < 0)
      {
      result->tv_sec--;
      result->tv_usec += 1000000;
      }
      return 0;
      }

      int main(int argc, const char * argv[]) {
      //count time!!!
      struct timeval start,stop,diff;
      memset(&start,0,sizeof(struct timeval));
      memset(&stop,0,sizeof(struct timeval));
      memset(&diff,0,sizeof(struct timeval));
      gettimeofday(&start,0);
      //count time!!!

      char * message = "By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. ";
      printf("Input : %sn",message);
      char * key = "key";

      char * encrypted = xorencrypt(message, key);
      printf("Encrypted: %sn", encrypted);

      char * message1 = xordecode(encrypted, key);
      printf("Decrypted: %sn", message1);

      //count time!!!
      gettimeofday(&stop,0);
      time_substract(&diff,&start,&stop);
      printf("Total time : %d s,%d usn",(int)diff.tv_sec,(int)diff.tv_usec);
      //count time!!!
      return 0;
      }









      share|improve this question







      New contributor



      Cyrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I wrote a C program is about vigenere encrypt and decode.
      And then, I want to add CPU and Memory usage in this program.



      However, I don't know what to add CPU and Memory code in this program.
      ※I just want to know CPU and Memory usage in this program.
      I hope everyone can help me. Thanks!!



      The following code is my C program of vigenere encrypt and decode



      #include <stdio.h>
      #include <stdlib.h>
      #include <string.h>
      #include <sys/time.h>
      #include <omp.h>

      int char_to_index(char c)
      {
      /*if(c>='A' && c<='Z'){
      c=c+32;
      }*/
      char x = c;
      char result = x - 'a';
      return (int)result;
      }

      char index_to_char(int c)
      {
      int result = c + 97;
      return (char)result;
      }

      char * xorencrypt(char * message, char * key) {
      int i;
      size_t messagelen = strlen(message);
      size_t keylen = strlen(key);

      char * encrypted = malloc(messagelen+1);
      //start to parallel
      omp_set_num_threads(8);
      #pragma omp parallel
      private(i)
      #pragma omp for
      for (i = 0; i < messagelen; i++) {
      int buf1 = char_to_index(message[i]);
      int buf2 = char_to_index(key[i % keylen]);
      char r = index_to_char(buf1 ^ buf2);
      encrypted[i] = r;
      }

      encrypted[messagelen] = '';

      return encrypted;
      }

      char * xordecode(char * cript, char * key) {
      int i;
      size_t criptlen = strlen(cript);
      size_t keylen = strlen(key);

      char * message = malloc(criptlen+1);
      //start to parallel
      omp_set_num_threads(8);
      #pragma omp parallel
      private(i)
      #pragma omp for
      for (i = 0; i < criptlen; i++) {
      int buf1 = char_to_index(cript[i]);
      int buf2 = char_to_index(key[i % keylen]);
      char r = index_to_char(buf1 ^ buf2);
      message[i] = r;
      }

      message[criptlen] = '';

      return message;
      }

      int time_substract(struct timeval *result, struct timeval *begin,struct timeval *end)
      {
      if(begin->tv_sec > end->tv_sec) return -1;
      if((begin->tv_sec == end->tv_sec) && (begin->tv_usec > end->tv_usec)) return -2;
      result->tv_sec = (end->tv_sec - begin->tv_sec);
      result->tv_usec = (end->tv_usec - begin->tv_usec);

      if(result->tv_usec < 0)
      {
      result->tv_sec--;
      result->tv_usec += 1000000;
      }
      return 0;
      }

      int main(int argc, const char * argv[]) {
      //count time!!!
      struct timeval start,stop,diff;
      memset(&start,0,sizeof(struct timeval));
      memset(&stop,0,sizeof(struct timeval));
      memset(&diff,0,sizeof(struct timeval));
      gettimeofday(&start,0);
      //count time!!!

      char * message = "By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. By using the article the, we’ve shown that it was one specific day that was long and one specific cup of tea that tasted good. ";
      printf("Input : %sn",message);
      char * key = "key";

      char * encrypted = xorencrypt(message, key);
      printf("Encrypted: %sn", encrypted);

      char * message1 = xordecode(encrypted, key);
      printf("Decrypted: %sn", message1);

      //count time!!!
      gettimeofday(&stop,0);
      time_substract(&diff,&start,&stop);
      printf("Total time : %d s,%d usn",(int)diff.tv_sec,(int)diff.tv_usec);
      //count time!!!
      return 0;
      }






      linux c cpu-usage






      share|improve this question







      New contributor



      Cyrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question







      New contributor



      Cyrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question






      New contributor



      Cyrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 1 hour ago









      CyrusCyrus

      1




      1




      New contributor



      Cyrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      Cyrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.
























          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Cyrus is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f522745%2fhow-to-get-cpu-and-memory-usage-in-c-in-linux-system%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Cyrus is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Cyrus is a new contributor. Be nice, and check out our Code of Conduct.













          Cyrus is a new contributor. Be nice, and check out our Code of Conduct.












          Cyrus is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f522745%2fhow-to-get-cpu-and-memory-usage-in-c-in-linux-system%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...