LCOV - code coverage report
Current view: top level - export/scratch1/home/monet/testing/f8e03e321dba-5-1-1/build/tools/mserver - monet_version.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 27 29 93.1 %
Date: 2024-04-26 00:35:57 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :  * SPDX-License-Identifier: MPL-2.0
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  *
       8             :  * Copyright 2024 MonetDB Foundation;
       9             :  * Copyright August 2008 - 2023 MonetDB B.V.;
      10             :  * Copyright 1997 - July 2008 CWI.
      11             :  */
      12             : 
      13             : #include "monetdb_config.h"
      14             : #include "mal.h"
      15             : #include "monet_version.h"
      16             : #include "mutils.h"
      17             : #ifdef HAVE_LIBPCRE
      18             : #include <pcre.h>
      19             : #endif
      20             : #ifdef HAVE_LIBXML
      21             : #include <libxml/xmlversion.h>
      22             : #endif
      23             : 
      24             : #define STRING(a)  # a
      25             : #define XSTRING(s) STRING(s)
      26             : 
      27             : #if defined(HAVE_LIBPCRE)
      28             : static void
      29           1 : print_libversion(const char *lib, const char *rtvers, const char *cmvers)
      30             : {
      31           1 :         printf("  %s: %s", lib, rtvers);
      32           1 :         if (strcmp(rtvers, cmvers) != 0)
      33           0 :                 printf(" (compiled with %s)", cmvers);
      34           1 :         printf("\n");
      35           1 : }
      36             : #endif
      37             : 
      38             : void
      39           1 : monet_version(void)
      40             : {
      41           1 :         dbl sz_mem_gb;
      42           1 :         int cores;
      43             : 
      44           1 :         MT_init();  /* for MT_pagesize */
      45           1 :         sz_mem_gb = (dbl)(MT_npages() * MT_pagesize()) / (1024.0 * 1024.0 * 1024.0);
      46           1 :         cores = MT_check_nr_cores();
      47             : 
      48           1 :         printf("MonetDB 5 server %s", GDKversion());
      49             : #ifdef MONETDB_RELEASE
      50             :         printf(" (%s)", MONETDB_RELEASE);
      51             : #else
      52           1 :         const char *rev = mercurial_revision();
      53           1 :         if (strcmp(rev, "Unknown") != 0)
      54           0 :                 printf(" (hg id: %s)", rev);
      55             : #endif
      56           1 :         printf(" (%zu-bit%s)\n",
      57             :                         (size_t) (sizeof(ptr) * 8),
      58             : #ifdef HAVE_HGE
      59             :                         ", 128-bit integers"
      60             : #else
      61             :                         ""
      62             : #endif
      63             :         );
      64             : #ifndef MONETDB_RELEASE
      65           1 :         printf("This is an unreleased version\n");
      66             : #endif
      67           1 :         printf("Copyright (c) 1993 - July 2008 CWI\n"
      68             :                "Copyright (c) August 2008 - 2023 MonetDB B.V., all rights reserved\n");
      69           1 :         printf("Visit https://www.monetdb.org/ for further information\n");
      70           1 :         printf("Found %.1fGiB available memory, %d available cpu core%s\n",
      71             :                         sz_mem_gb, cores, cores != 1 ? "s" : "");
      72             :         /* don't want to GDKinit just for this
      73             :                         "using %d thread%s\n",
      74             :                         GDKnr_threads, GDKnr_threads != 1 ? "s" : ""); */
      75           1 :         printf("Libraries:\n");
      76             : #ifdef HAVE_LIBPCRE
      77             :         /* PCRE_PRERELEASE may be defined as an empty value.  In order
      78             :          * to get the proper amount of white space between various
      79             :          * parts of the version string on different compilers (none
      80             :          * between minor and prerelease, a single one between that
      81             :          * combination and the date), we need to resort to some
      82             :          * run-time trickery since we can't do it with the
      83             :          * preprocessor */
      84           1 :         print_libversion("libpcre",
      85             :                          pcre_version(),
      86             :                          XSTRING(Z PCRE_PRERELEASE)[1] == 0
      87             :                          ? XSTRING(PCRE_MAJOR.PCRE_MINOR PCRE_DATE)
      88             :                          : XSTRING(PCRE_MAJOR.PCRE_MINOR)
      89             :                            XSTRING(PCRE_PRERELEASE PCRE_DATE));
      90             : #endif
      91             : #ifdef HAVE_LIBXML
      92             :         /* no run-time version available, so only compile time */
      93           1 :         printf("  libxml2: %s\n", LIBXML_DOTTED_VERSION);
      94             : #endif
      95           1 :         printf("Compiled by: %s (%s)\n", "monet@lab06.da.cwi.nl", HOST);
      96           1 :         printf("Compilation: %s\n", "/usr/bin/cc --coverage");
      97           1 :         printf("Linking    : %s\n", "/usr/bin/ld");
      98           1 :         fflush(stdout);
      99           1 : }

Generated by: LCOV version 1.14