Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/tools/perf/tests/workloads/   (Linux Kernel Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 667 B image not shown  

Quelle  sqrtloop.c

  Sprache: C
 

/* SPDX-License-Identifier: GPL-2.0 */
#include <math.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/compiler.h>
#include <sys/wait.h>
#include "../tests.h"

static volatile sig_atomic_t done;

static void sighandler(int sig __maybe_unused)
{
 done = 1;
}

static int __sqrtloop(int sec)
{
 signal(SIGALRM, sighandler);
 alarm(sec);

 while (!done)
  (void)sqrt(rand());
 return 0;
}

static int sqrtloop(int argc, const char **argv)
{
 int sec = 1;

 if (argc > 0)
  sec = atoi(argv[0]);

 switch (fork()) {
 case 0:
  return __sqrtloop(sec);
 case -1:
  return -1;
 default:
  wait(NULL);
 }
 return 0;
}

DEFINE_WORKLOAD(sqrtloop);

Messung V0.5 in Prozent
C=97 H=89 G=93

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-06-07) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.