<commit_before>/*
** Author(s):
** - <NAME> <<EMAIL>>
**
** Copyright (C) 2013 Aldebaran Robotics
*/

#include <qiperf/measure.hpp>

#ifdef __linux__
#include <dirent.h>
#include <unistd.h>
#include <cstdio>
#endif

namespace qi
{
  namespace measure
  {
    int getNumFD()
    {
      int fd_count = -1;

#ifdef __linux__
      char buf[64];

      snprintf(buf, 64, "/proc/%i/fd/", getpid());

      DIR *dir = opendir(buf);
      if (dir == NULL)
        return -1;

      while (readdir(dir) != NULL)
        ++fd_count;
      closedir(dir);
#endif

      return fd_count;
    }
  }
}<commit_msg>use /proc/self instead of using getpid()<commit_after>/*
** Author(s):
** - <NAME> <<EMAIL>>
**
** Copyright (C) 2013 Aldebaran Robotics
*/

#include <qiperf/measure.hpp>

#ifdef __linux__
#include <dirent.h>
#include <unistd.h>
#endif

namespace qi
{
  namespace measure
  {
    int getNumFD()
    {
      int fdCount = -1;

#ifdef __linux__
      DIR *dir = opendir("/proc/self/fd/");
      if (dir == NULL)
        return -1;

      while (readdir(dir) != NULL)
        ++fdCount;
      closedir(dir);
#endif

      return fdCount;
    }
  }
}
{'fraction_non_alphanumeric': 0.1649214659685864, 'fraction_numerical': 0.013961605584642234, 'mean_word_length': 2.4969512195121952, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3776699', 'n_tokens_mistral': 457, 'n_tokens_neox': 435, 'n_words': 103}