diff options
author | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:41 -0500 |
---|---|---|
committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:41 -0500 |
commit | 11b8179a57e675c6672cbe649c655230ae3e9744 (patch) | |
tree | 2919c366d51e154e65279156fef5b4f97b8fd2f9 /arch/common/.svn/text-base | |
parent | 720f5023a8f68aaaa54cb6b7bf46efee23b5b4c3 (diff) |
Import Upstream version 0.4.2.1
Diffstat (limited to 'arch/common/.svn/text-base')
-rw-r--r-- | arch/common/.svn/text-base/blowfish.h.svn-base | 70 | ||||
-rw-r--r-- | arch/common/.svn/text-base/display.h.svn-base | 137 | ||||
-rw-r--r-- | arch/common/.svn/text-base/fib.h.svn-base | 50 | ||||
-rw-r--r-- | arch/common/.svn/text-base/languages.h.svn-base | 102 | ||||
-rw-r--r-- | arch/common/.svn/text-base/md5.h.svn-base | 67 | ||||
-rw-r--r-- | arch/common/.svn/text-base/printers.h.svn-base | 81 | ||||
-rw-r--r-- | arch/common/.svn/text-base/sha1.h.svn-base | 67 | ||||
-rw-r--r-- | arch/common/.svn/text-base/users.h.svn-base | 63 | ||||
-rw-r--r-- | arch/common/.svn/text-base/zlib.h.svn-base | 90 |
9 files changed, 0 insertions, 727 deletions
diff --git a/arch/common/.svn/text-base/blowfish.h.svn-base b/arch/common/.svn/text-base/blowfish.h.svn-base deleted file mode 100644 index ad4bdb92..00000000 --- a/arch/common/.svn/text-base/blowfish.h.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -/* - * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <blowfish.h> - -gchar * -benchmark_fish(void) -{ - BLOWFISH_CTX ctx; - GTimer *timer = g_timer_new(); - gdouble elapsed = 0; - gchar src[65536], *tmpsrc; - glong srclen = 65536; - unsigned long L, R; - int i; - - tmpsrc = src; - - L = 0xBEBACAFE; - R = 0xDEADBEEF; - - gchar *bdata_path; - - bdata_path = g_strdup_printf("%s/hardinfo/benchmark.data", - gbr_find_data_dir(PREFIX)); - - if (!g_file_get_contents(bdata_path, &tmpsrc, NULL, NULL)) { - g_free(bdata_path); - return g_strdup("[Error]\n" - PREFIX "benchmark.data not found=\n"); - } - - shell_view_set_enabled(FALSE); - shell_status_update("Benchmarking..."); - - for (i = 0; i <= 50000; i++) { - g_timer_start(timer); - - Blowfish_Init(&ctx, (unsigned char*)tmpsrc, srclen); - Blowfish_Encrypt(&ctx, &L, &R); - Blowfish_Decrypt(&ctx, &L, &R); - - g_timer_stop(timer); - elapsed += g_timer_elapsed(timer, NULL); - - shell_status_set_percentage(i/500); - } - - g_timer_destroy(timer); - g_free(bdata_path); - - gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n" - "<b>This Machine</b>=<b>%.2f</b>\n", elapsed); - return benchmark_include_results(retval, "Blowfish"); -} diff --git a/arch/common/.svn/text-base/display.h.svn-base b/arch/common/.svn/text-base/display.h.svn-base deleted file mode 100644 index 6731e3e3..00000000 --- a/arch/common/.svn/text-base/display.h.svn-base +++ /dev/null @@ -1,137 +0,0 @@ -/* - * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -static void -get_glx_info(DisplayInfo *di) -{ - gchar *output; - if (g_spawn_command_line_sync("glxinfo", &output, NULL, NULL, NULL)) { - gchar **output_lines, **old; - - output_lines = g_strsplit(output, "\n", 0); - g_free(output); - - old = output_lines; - while (*(++output_lines)) { - if (strstr(*output_lines, "OpenGL")) { - gchar **tmp = g_strsplit(*output_lines, ":", 0); - - tmp[1] = g_strchug(tmp[1]); - - get_str("OpenGL vendor str", di->ogl_vendor); - get_str("OpenGL renderer str", di->ogl_renderer); - get_str("OpenGL version str", di->ogl_version); - - g_strfreev(tmp); - } - } - - g_strfreev(old); - - if (!di->ogl_vendor) - di->ogl_vendor = "Unknown"; - if (!di->ogl_renderer) - di->ogl_renderer = "Unknown"; - if (!di->ogl_version) - di->ogl_version = "Unknown"; - } else { - di->ogl_vendor = di->ogl_renderer = di->ogl_version = "Unknown"; - } - -} - -static void -get_x11_info(DisplayInfo *di) -{ - gchar *output; - - if (g_spawn_command_line_sync("xdpyinfo", &output, NULL, NULL, NULL)) { - gchar **output_lines, **old; - - output_lines = g_strsplit(output, "\n", 0); - g_free(output); - - old = output_lines; - while (*(output_lines++)) { - gchar **tmp = g_strsplit(*output_lines, ":", 0); - - if (tmp[1] && tmp[0]) { - tmp[1] = g_strchug(tmp[1]); - - get_str("vendor string", di->vendor); - get_str("X.Org version", di->version); - get_str("XFree86 version", di->version); - - if (g_str_has_prefix(tmp[0], "number of extensions")) { - int n; - - di->extensions = ""; - - for (n = atoi(tmp[1]); n; n--) { - di->extensions = g_strconcat(di->extensions, - g_strstrip(*(++output_lines)), - "=\n", - NULL); - } - g_strfreev(tmp); - - break; - } - } - - g_strfreev(tmp); - } - - g_strfreev(old); - } - - GdkScreen *screen = gdk_screen_get_default(); - - if (screen && GDK_IS_SCREEN(screen)) { - gint n_monitors = gdk_screen_get_n_monitors(screen); - gint i; - - di->monitors = ""; - for (i = 0; i < n_monitors; i++) { - GdkRectangle rect; - - gdk_screen_get_monitor_geometry(screen, i, &rect); - - di->monitors = g_strdup_printf("%sMonitor %d=%dx%d pixels\n", - di->monitors, i, rect.width, rect.height); - } - } else { - di->monitors = ""; - } -} - -static DisplayInfo * -computer_get_display(void) -{ - DisplayInfo *di = g_new0(DisplayInfo, 1); - - GdkScreen *screen = gdk_screen_get_default(); - - di->width = gdk_screen_get_width(screen); - di->height = gdk_screen_get_height(screen); - - get_glx_info(di); - get_x11_info(di); - - return di; -} diff --git a/arch/common/.svn/text-base/fib.h.svn-base b/arch/common/.svn/text-base/fib.h.svn-base deleted file mode 100644 index 493cfd0f..00000000 --- a/arch/common/.svn/text-base/fib.h.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/* - * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -static unsigned long long -fib(unsigned long long n) -{ - if (n == 0) - return 0; - else if (n == 1 || n == 2) - return 1; - return fib(n - 1) + fib(n - 2); -} - -static gchar * -benchmark_fib(void) -{ - GTimer *timer = g_timer_new(); - gdouble elapsed = 0; - - shell_view_set_enabled(FALSE); - shell_status_update("Calculating the 42<sup>th</sup> Fibonacci number..."); - - g_timer_start(timer); - fib(42); /* the answer? :) */ - g_timer_stop(timer); - - elapsed = g_timer_elapsed(timer, NULL); - - g_timer_destroy(timer); - - gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n" - "<b>This Machine</b>=<b>%.2f</b>\n", elapsed); - return benchmark_include_results(retval, "Fibonacci"); -} - diff --git a/arch/common/.svn/text-base/languages.h.svn-base b/arch/common/.svn/text-base/languages.h.svn-base deleted file mode 100644 index 71e05dab..00000000 --- a/arch/common/.svn/text-base/languages.h.svn-base +++ /dev/null @@ -1,102 +0,0 @@ -/* - * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -void -scan_languages(OperatingSystem * os) -{ - FILE *locale; - gchar buf[512], *retval = ""; - - locale = popen("locale -va", "r"); - if (!locale) - return; - - gchar name[32]; - gchar *title = NULL, - *source = NULL, - *address = NULL, - *email = NULL, - *language = NULL, - *territory = NULL, - *revision = NULL, - *date = NULL, - *codeset = NULL; - - while (fgets(buf, 512, locale)) { - if (!strncmp(buf, "locale:", 7)) { - sscanf(buf, "locale: %s", name); - fgets(buf, 128, locale); - } else if (strchr(buf, '|')) { - gchar **tmp = g_strsplit(buf, "|", 2); - - tmp[0] = g_strstrip(tmp[0]); - - if (tmp[1]) { - tmp[1] = g_strstrip(tmp[1]); - - get_str("title", title); - get_str("source", source); - get_str("address", address); - get_str("email", email); - get_str("language", language); - get_str("territory", territory); - get_str("revision", revision); - get_str("date", date); - get_str("codeset", codeset); - } - - g_strfreev(tmp); - } else { - gchar *currlocale; - - retval = g_strdup_printf("%s$%s$%s=%s\n", retval, name, name, title); - - currlocale = g_strdup_printf("[Locale Information]\n" - "Name=%s (%s)\n" - "Source=%s\n" - "Address=%s\n" - "Email=%s\n" - "Language=%s\n" - "Territory=%s\n" - "Revision=%s\n" - "Date=%s\n" - "Codeset=%s\n", name, title, - source, address, email, language, - territory, revision, date, - codeset); - - g_hash_table_insert(moreinfo, g_strdup(name), currlocale); - - g_free(title); - g_free(source); - g_free(address); - g_free(email); - g_free(language); - g_free(territory); - g_free(revision); - g_free(date); - g_free(codeset); - - title = source = address = email = language = territory = \ - revision = date = codeset = NULL; - } - } - - fclose(locale); - - os->languages = retval; -} diff --git a/arch/common/.svn/text-base/md5.h.svn-base b/arch/common/.svn/text-base/md5.h.svn-base deleted file mode 100644 index 256d6c3b..00000000 --- a/arch/common/.svn/text-base/md5.h.svn-base +++ /dev/null @@ -1,67 +0,0 @@ -/* - * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <md5.h> - -gchar * -benchmark_md5(void) -{ - struct MD5Context ctx; - guchar checksum[16]; - int i; - GTimer *timer = g_timer_new(); - gdouble elapsed = 0; - gchar src[65536], *tmpsrc; - glong srclen = 65536; - - tmpsrc = src; - - gchar *bdata_path; - - bdata_path = g_strdup_printf("%s/hardinfo/benchmark.data", - gbr_find_data_dir(PREFIX)); - if (!g_file_get_contents(bdata_path, &tmpsrc, NULL, NULL)) { - g_free(bdata_path); - return g_strdup("[Error]\n" - PREFIX "benchmark.data not found=\n"); - } - - shell_view_set_enabled(FALSE); - shell_status_update("Generating MD5 sum for 312MiB of data..."); - - for (i = 0; i <= 5000; i++) { - g_timer_start(timer); - - MD5Init(&ctx); - MD5Update(&ctx, (guchar*)tmpsrc, srclen); - MD5Final(checksum, &ctx); - - g_timer_stop(timer); - elapsed += g_timer_elapsed(timer, NULL); - - shell_status_set_percentage(i/50); - } - - g_timer_destroy(timer); - g_free(bdata_path); - - gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n" - "<b>This Machine</b>=<b>%.2f</b>\n", elapsed); - return benchmark_include_results(retval, "MD5"); -} - diff --git a/arch/common/.svn/text-base/printers.h.svn-base b/arch/common/.svn/text-base/printers.h.svn-base deleted file mode 100644 index 01beb5dd..00000000 --- a/arch/common/.svn/text-base/printers.h.svn-base +++ /dev/null @@ -1,81 +0,0 @@ -/* - * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -void -scan_printers(void) -{ - static GModule *cups = NULL; - static int (*cupsGetPrinters) (char ***printers) = NULL; - static char *(*cupsGetDefault) (void) = NULL; - static char *libcups[] = { "libcups", - "libcups.so", - "libcups.so.1", - "libcups.so.2", - NULL }; - - if (printer_list) - g_free(printer_list); - - if (!(cupsGetPrinters && cupsGetDefault)) { - int i; - - for (i = 0; libcups[i] != NULL; i++) { - cups = g_module_open(libcups[i], G_MODULE_BIND_LAZY); - if (cups) - break; - } - - if (!cups) { - printer_list = g_strdup("[Printers]\n" - "CUPS libraries cannot be found="); - return; - } - - if (!g_module_symbol(cups, "cupsGetPrinters", (gpointer) & cupsGetPrinters) - || !g_module_symbol(cups, "cupsGetDefault", - (gpointer) & cupsGetDefault)) { - printer_list = - g_strdup("[Printers]\n" - "No suitable CUPS library found="); - g_module_close(cups); - return; - } - } - - gchar **printers; - int noprinters, i; - const char *default_printer; - - noprinters = cupsGetPrinters(&printers); - default_printer = cupsGetDefault(); - - if (noprinters > 0) { - printer_list = g_strdup_printf("[Printers (CUPS)]\n"); - for (i = 0; i < noprinters; i++) { - printer_list = g_strconcat(printer_list, printers[i], - !strcmp(default_printer, - printers[i]) ? - "=<i>(Default)</i>\n" : "=\n", - NULL); - g_free(printers[i]); - } - } else { - printer_list = g_strdup("[Printers]\n" - "No printers found"); - } -} diff --git a/arch/common/.svn/text-base/sha1.h.svn-base b/arch/common/.svn/text-base/sha1.h.svn-base deleted file mode 100644 index 4bd07276..00000000 --- a/arch/common/.svn/text-base/sha1.h.svn-base +++ /dev/null @@ -1,67 +0,0 @@ -/* - * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include <sha1.h> - -gchar * -benchmark_sha1(void) -{ - SHA1_CTX ctx; - guchar checksum[20]; - int i; - GTimer *timer = g_timer_new(); - gdouble elapsed = 0; - gchar src[65536], *tmpsrc; - glong srclen = 65536; - - tmpsrc = src; - - gchar *bdata_path; - - bdata_path = g_strdup_printf("%s/hardinfo/benchmark.data", - gbr_find_data_dir(PREFIX)); - - if (!g_file_get_contents(bdata_path, &tmpsrc, NULL, NULL)) { - g_free(bdata_path); - return g_strdup("[Error]\n" - PREFIX "benchmark.data not found=\n"); - } - - shell_view_set_enabled(FALSE); - shell_status_update("Generating SHA1 sum for 312MiB of data..."); - - for (i = 0; i <= 5000; i++) { - g_timer_start(timer); - - SHA1Init(&ctx); - SHA1Update(&ctx, (guchar*)tmpsrc, srclen); - SHA1Final(checksum, &ctx); - - g_timer_stop(timer); - elapsed += g_timer_elapsed(timer, NULL); - - shell_status_set_percentage(i/50); - } - - g_timer_destroy(timer); - g_free(bdata_path); - - gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n" - "<b>This Machine</b>=<b>%.2f</b>\n", elapsed); - return benchmark_include_results(retval, "SHA1"); -} - diff --git a/arch/common/.svn/text-base/users.h.svn-base b/arch/common/.svn/text-base/users.h.svn-base deleted file mode 100644 index 08acd97a..00000000 --- a/arch/common/.svn/text-base/users.h.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -static gchar *sys_users = NULL, - *human_users = NULL; - -static gboolean -remove_users(gpointer key, gpointer value, gpointer data) -{ - if (!strncmp((gchar *) key, "USER", 4)) { - /* - * g_free((gchar *) key); - * g_free((GtkTreeIter *) value); - */ - return TRUE; - } - return FALSE; -} - -void scan_users(void) -{ - FILE *passwd; - char buffer[512]; - - passwd = fopen("/etc/passwd", "r"); - if (!passwd) - return; - - if (sys_users) { - g_free(sys_users); - g_free(human_users); - - g_hash_table_foreach_remove(moreinfo, remove_users, NULL); - } - - sys_users = g_strdup(""); - human_users = g_strdup(""); - - while (fgets(buffer, 512, passwd)) { - gchar **tmp; - gint uid; - - tmp = g_strsplit(buffer, ":", 0); - - gchar *key = g_strdup_printf("USER%s", tmp[0]); - gchar *val = g_strdup_printf("[User Information]\n" - "User ID=%s\n" - "Group ID=%s\n" - "Home directory=%s\n" - "Default shell=%s\n", - tmp[2], tmp[3], tmp[5], tmp[6]); - g_hash_table_insert(moreinfo, key, val); - - uid = atoi(tmp[2]); - strend(tmp[4], ','); - if (uid >= 1000 && uid <= 65530) { - human_users = g_strdup_printf("%s$%s$%s=%s\n", human_users, key, tmp[0], tmp[4]); - } else { - sys_users = g_strdup_printf("%s$%s$%s=%s\n", sys_users, key, tmp[0], tmp[4]); - } - - g_strfreev(tmp); - } - - fclose(passwd); -} diff --git a/arch/common/.svn/text-base/zlib.h.svn-base b/arch/common/.svn/text-base/zlib.h.svn-base deleted file mode 100644 index 2a1007ed..00000000 --- a/arch/common/.svn/text-base/zlib.h.svn-base +++ /dev/null @@ -1,90 +0,0 @@ -/* - * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -static gchar * -benchmark_zlib(void) -{ - GModule *libz; - static gulong (*compressBound) (glong srclen) = NULL; - static gint (*compress) (gchar *dst, glong *dstlen, - const gchar *src, glong srclen) = NULL; - - if (!(compress && compressBound)) { - libz = g_module_open("libz", G_MODULE_BIND_LAZY); - if (!libz) { - libz = g_module_open("/lib/libz.so", G_MODULE_BIND_LAZY); - if (!libz) { - g_warning("Cannot load ZLib: %s", g_module_error()); - return g_strdup("[Error]\n" - "ZLib not found="); - } - } - - if (!g_module_symbol(libz, "compress", (gpointer) & compress) - || !g_module_symbol(libz, "compressBound", (gpointer) & compressBound)) { - - g_module_close(libz); - return g_strdup("[Error]\n" - "Invalid Z-Lib found="); - } - } - - shell_view_set_enabled(FALSE); - - int i; - GTimer *timer = g_timer_new(); - gdouble elapsed = 0; - gchar src[65536], *tmpsrc; - glong srclen = 65536; - gchar *bdata_path; - - bdata_path = g_strdup_printf("%s/hardinfo/benchmark.data", - gbr_find_data_dir(PREFIX)); - - if (!g_file_get_contents(bdata_path, &tmpsrc, NULL, NULL)) { - g_free(bdata_path); - return g_strdup("[Error]\n" - PREFIX "benchmark.data not found=\n"); - } - - shell_status_update("Compressing 64MB with default options..."); - - for (i = 0; i <= 1000; i++) { - g_timer_start(timer); - - gchar *dst; - glong dstlen = compressBound(srclen); - - dst = g_new0(gchar, dstlen); - compress(dst, &dstlen, src, srclen); - - g_timer_stop(timer); - elapsed += g_timer_elapsed(timer, NULL); - g_free(dst); - - shell_status_set_percentage(i/10); - } - - g_timer_destroy(timer); - g_free(bdata_path); - - gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n" - "<b>This Machine</b>=<b>%.2f</b>\n", elapsed); - return benchmark_include_results(retval, "ZLib"); -} - |