<commit_before>#ifndef _UTIL_HPP_
#define _UTIL_HPP_

#include <string>
#include <string_view>

namespace metric_blob
{

struct TcommUtimeStime
{
    std::string tcomm;
    float utime;
    float stime;
};

TcommUtimeStime parseTcommUtimeStimeString(std::string_view content,
                                           long ticksPerSec);
std::string readFileIntoString(std::string_view fileName);
bool isNumericPath(std::string_view path, int& value);
TcommUtimeStime getTcommUtimeStime(int pid, long ticksPerSec);
std::string getCmdLine(int pid);
bool parseMeminfoValue(std::string_view content, std::string_view keyword,
                       int& value);
bool parseProcUptime(const std::string_view content, double& uptime,
                     double& idleProcessTime);
long getTicksPerSec();
char controlCharsToSpace(char c);
std::string trimStringRight(std::string_view s);

} // namespace metric_blob

#endif<commit_msg>metrics-ipmi-blobs: util: openbmc uses pragma once<commit_after>#pragma once

#include <string>
#include <string_view>

namespace metric_blob
{

struct TcommUtimeStime
{
    std::string tcomm;
    float utime;
    float stime;
};

TcommUtimeStime parseTcommUtimeStimeString(std::string_view content,
                                           long ticksPerSec);
std::string readFileIntoString(std::string_view fileName);
bool isNumericPath(std::string_view path, int& value);
TcommUtimeStime getTcommUtimeStime(int pid, long ticksPerSec);
std::string getCmdLine(int pid);
bool parseMeminfoValue(std::string_view content, std::string_view keyword,
                       int& value);
bool parseProcUptime(const std::string_view content, double& uptime,
                     double& idleProcessTime);
long getTicksPerSec();
char controlCharsToSpace(char c);
std::string trimStringRight(std::string_view s);

} // namespace metric_blob
{'fraction_non_alphanumeric': 0.09247311827956989, 'fraction_numerical': 0.0, 'mean_word_length': 4.227528089887641, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7559861', 'n_tokens_mistral': 573, 'n_tokens_neox': 560, 'n_words': 131}