LCOV - code coverage report
Current view: top level - root/contrail/src/contrail-common/base - misc_utils.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 4 14 28.6 %
Date: 2026-08-03 02:19:58 Functions: 2 4 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #include <fstream>
       6             : #include <sstream>
       7             : #include <stdlib.h>
       8             : #include <base/misc_utils.h>
       9             : #include <base/logging.h>
      10             : #include <netdb.h>
      11             : #include <netinet/in.h>
      12             : #include <arpa/inet.h>
      13             : #include "base/sandesh/version_types.h"
      14             : #include "base/logging.h"
      15             : #include "rapidjson/document.h"
      16             : #include "rapidjson/writer.h"
      17             : #include "rapidjson/stringbuffer.h"
      18             : 
      19             : using namespace std;
      20             : 
      21             : const map<MiscUtils::BuildModule, string> MiscUtils::BuildModuleNames =
      22             :     MiscUtils::MapInit();
      23             : time_t MiscUtils::startup_time_secs_ = MiscUtils::set_startup_time_secs();
      24             : 
      25             : SandeshTraceBufferPtr VersionTraceBuf(SandeshTraceBufferCreate(
      26             :                                        VERSION_TRACE_BUF, 500));
      27             : 
      28           0 : string MiscUtils::BaseName(string filename) {
      29           0 :     size_t pos = filename.find_last_of('/');
      30           0 :     if (pos != string::npos) {
      31           0 :         return filename.substr((pos+1));
      32             :     }
      33           0 :     return filename;
      34             : }
      35             : 
      36           0 : void MiscUtils::LogVersionInfo(const string build_info, Category::type categ) {
      37           0 :     VERSION_TRACE(VersionInfoTrace, build_info);
      38           0 :     if (!LoggingDisabled()) {
      39           0 :         VERSION_LOG(VersionInfoLog, categ, build_info);
      40             :     }
      41           0 : }
      42             : 
      43       11182 : time_t MiscUtils::GetUpTimeSeconds() {
      44       11182 :     return (UTCTimestamp() - startup_time_secs_);
      45             : }
      46             : 
      47         984 : time_t MiscUtils::set_startup_time_secs() {
      48         984 :     return (startup_time_secs_ = UTCTimestamp());
      49             : }

Generated by: LCOV version 1.14