]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
python: Drop performance_index function
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Feb 2023 17:03:04 +0000 (17:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Feb 2023 17:03:04 +0000 (17:03 +0000)
We no longer use this.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/_pakfiremodule.c
src/_pakfire/util.c
src/_pakfire/util.h

index 839d0ac76fce10dcc872a46c92d1c60f3435a43b..26bb5a63be6aa8bb5950f9d76d091b6a71d80750 100644 (file)
@@ -91,7 +91,6 @@ ERROR:
 }
 
 static PyMethodDef pakfireModuleMethods[] = {
-       {"performance_index", (PyCFunction)performance_index, METH_VARARGS, NULL},
        {"native_arch", (PyCFunction)_pakfire_native_arch, METH_NOARGS, NULL },
        {"supported_arches", (PyCFunction)_pakfire_supported_arches, METH_NOARGS, NULL },
        { NULL, NULL, 0, NULL }
index 4f883d09c489ca576b1a4afb8a7953017d79897d..a5d282fa0bc48d5af3639181eeb26e46a6bdb58a 100644 (file)
@@ -22,8 +22,6 @@
 #include <datetime.h>
 
 #include <errno.h>
-#include <time.h>
-#include <unistd.h>
 
 #include <pakfire/filelist.h>
 #include <pakfire/package.h>
 #include "package.h"
 #include "util.h"
 
-static unsigned long fibonnacci(const clock_t* deadline) {
-       clock_t now = clock();
-
-       unsigned long f1 = 1;
-       unsigned long f2 = 1;
-
-       // Count iterations
-       unsigned long counter = 0;
-
-       while (now < *deadline) {
-               unsigned long next = f1 + f2;
-               f1 = f2;
-               f2 = next;
-
-               now = clock();
-               counter++;
-       }
-
-       return counter;
-}
-
-PyObject* performance_index(PyObject* self, PyObject* args) {
-       int seconds = 1;
-
-       if (!PyArg_ParseTuple(args, "|i", &seconds)) {
-               return NULL;
-       }
-
-       if (seconds == 0) {
-               PyErr_SetString(PyExc_ValueError, "Runtime must be one second or longer");
-               return NULL;
-       }
-
-       // Determine the number of online processors
-       int processors = sysconf(_SC_NPROCESSORS_ONLN);
-
-       // Determine deadline
-       clock_t deadline = clock();
-       deadline += CLOCKS_PER_SEC * seconds;
-
-       // Run Fibonnacci until deadline
-       unsigned long iterations = fibonnacci(&deadline);
-
-       // Times the result by the number of processors
-       iterations *= processors;
-
-       // Normalise to a second
-       iterations /= seconds;
-
-       return PyLong_FromUnsignedLong(iterations);
-}
-
 PyObject* PyList_FromPackageList(struct pakfire_packagelist* packagelist) {
        PyObject* list = PyList_New(0);
 
index e9cf9fe70ca9c28b59a31f2dbe1fe1eb1bd59439..c014a08e145c0a3b25c7b5301dcd296d6800c78b 100644 (file)
@@ -26,8 +26,6 @@
 #include <pakfire/filelist.h>
 #include <pakfire/packagelist.h>
 
-extern PyObject* performance_index(PyObject* self, PyObject* args);
-
 PyObject* PyList_FromPackageList(struct pakfire_packagelist* packagelist);
 PyObject* PyList_FromFileList(struct pakfire_filelist* filelist);