<commit_before>#pragma once

#include <sys/sdt.h>

// Systemtap is not available on OS X. The alternative would be dtrace. Actually, systemtap probes are compatible
// with dtrace probes and the other way round. However, Apple's dtrace implementation differs from the original solaris
// implementation. Thus, Apple's dtrace does not understand the USDT probe definition. In order to be able to compile
// the project on Mac we define the probes in this file.

// In order to be compatible with Mac dtrace probes, both provider and probe name have to be uppercase
constexpr bool is_valid_name(const char* name) {
  do {
    if (*name >= 'a' && *name <= 'z') return false;
    if (*name == '-') return false;
  } while (*++name != '\0');
  return true;
}

#if defined(__APPLE__) || defined(__MACOS__)

#include "provider.hpp"

// Construct the probe definition by provider and probe name
#define BUILD_PROBE_NAME(provider, probe, ...)                                                                     \
  static_assert(is_valid_name(#provider) && is_valid_name(#probe), "Provider and probe name must be upper case!"); \
  provider##_##probe(__VA_ARGS__);

#define DTRACE_PROBE(provider, probe) BUILD_PROBE_NAME(provider, probe);
#define DTRACE_PROBE1(provider, probe, param1) BUILD_PROBE_NAME(provider, probe, param1);<commit_msg>Disable USDT in TSan builds (#1175)<commit_after>#pragma once

#include <sys/sdt.h>

// Systemtap is not available on OS X. The alternative would be dtrace. Actually, systemtap probes are compatible
// with dtrace probes and the other way round. However, Apple's dtrace implementation differs from the original solaris
// implementation. Thus, Apple's dtrace does not understand the USDT probe definition. In order to be able to compile
// the project on Mac we define the probes in this file.

// In order to be compatible with Mac dtrace probes, both provider and probe name have to be uppercase
constexpr bool is_valid_name(const char* name) {
  do {
    if (*name >= 'a' && *name <= 'z') return false;
    if (*name == '-') return false;
  } while (*++name != '\0');
  return true;
}

#if defined(__APPLE__) || defined(__MACOS__)

#include "provider.hpp"

// Construct the probe definition by provider and probe name. Because TSan has issues and throw false positives, we
// don't use probes in TSan builds
#ifndef __SANITIZE_THREAD__
#define BUILD_PROBE_NAME(provider, probe, ...)                                                                     \
  static_assert(is_valid_name(#provider) && is_valid_name(#probe), "Provider and probe name must be upper case!"); \
  provider##_##probe(__VA_ARGS__);
#else
#define BUILD_PROBE_NAME(provider, probe, ...)
#endif

#define DTRACE_PROBE(provider, probe) BUILD_PROBE_NAME(provider, probe);
#define DTRACE_PROBE1(provider, probe, param1) BUILD_PROBE_NAME(provider, probe, param1);
{'fraction_non_alphanumeric': 0.10237596086652691, 'fraction_numerical': 0.0041928721174004195, 'mean_word_length': 3.6781045751633985, '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': '3201112', 'n_tokens_mistral': 824, 'n_tokens_neox': 792, 'n_words': 320}