<commit_before>/*
 * Copyright © 2010 CNRS, INRIA, Université Bordeaux 1
 * See COPYING in top-level directory.
 */

#include <private/config.h>
#include <hwloc.h>
#include <private/private.h>
#include <private/debug.h>
#include <private/cpuid.h>

struct cacheinfo {
  unsigned type;
  unsigned level;
  unsigned nbthreads_sharing;
  unsigned max_nbcores;
  unsigned nbthreads;

  unsigned linesize;
  unsigned linepart;
  unsigned ways;
  unsigned sets;
  unsigned size;
};

struct procinfo {
  unsigned present;
  unsigned apicid;
  unsigned max_log_proc;
  unsigned socketid;
  unsigned logprocid;
  unsigned threadid;
  unsigned coreid;
  unsigned numcaches;
  struct cacheinfo *cache;
};

/* Fetch information from the processor itself thanks to cpuid and store it in
 * infos for summarize to analyze them globally */
static void look_proc(struct procinfo *infos, unsigned highest_cpuid) {
  unsigned eax, ebx, ecx = 0, edx;
  unsigned cachenum;
  struct cacheinfo *cache;

  infos->present = 1;

  eax = 0x01;
  hwloc_cpuid(&eax, &ebx, &ecx, &edx);
  infos->apicid = ebx >> 24;
  if (edx & (1 << 28))
    infos->max_log_proc = (ebx >> 16) & 0xff;
  else
    infos->max_log_proc = 1;
  hwloc_debug("APIC ID 0x%02x max_log_proc %d\n", infos->apicid, infos->max_log_proc);
  infos->socketid = infos->apicid / infos->max_log_proc;
  infos->logprocid = infos->apicid % infos->max_log_proc;
  infos->coreid = (unsigned) -1;
  infos->threadid = (unsigned) -1;
  hwloc_debug("phys %d thread %d\n", infos->socketid, infos->logprocid);

  infos->numcaches = 0;
  infos->cache = NULL;

  if (highest_cpuid < 0x04)
    return;

  /* TODO: AMD version */<commit_msg>fix max_log_proc computation when it is not a p...<commit_after>/*
 * Copyright © 2010 CNRS, INRIA, Université Bordeaux 1
 * See COPYING in top-level directory.
 */

#include <private/config.h>
#include <hwloc.h>
#include <private/private.h>
#include <private/debug.h>
#include <private/cpuid.h>
#include <private/cpuset.h>

struct cacheinfo {
  unsigned type;
  unsigned level;
  unsigned nbthreads_sharing;
  unsigned max_nbcores;
  unsigned nbthreads;

  unsigned linesize;
  unsigned linepart;
  unsigned ways;
  unsigned sets;
  unsigned size;
};

struct procinfo {
  unsigned present;
  unsigned apicid;
  unsigned max_log_proc;
  unsigned socketid;
  unsigned logprocid;
  unsigned threadid;
  unsigned coreid;
  unsigned numcaches;
  struct cacheinfo *cache;
};

/* Fetch information from the processor itself thanks to cpuid and store it in
 * infos for summarize to analyze them globally */
static void look_proc(struct procinfo *infos, unsigned highest_cpuid) {
  unsigned eax, ebx, ecx = 0, edx;
  unsigned cachenum;
  struct cacheinfo *cache;

  infos->present = 1;

  eax = 0x01;
  hwloc_cpuid(&eax, &ebx, &ecx, &edx);
  infos->apicid = ebx >> 24;
  if (edx & (1 << 28))
    infos->max_log_proc = 1 << hwloc_flsl((ebx >> 16) & 0xff);
  else
    infos->max_log_proc = 1;
  hwloc_debug("APIC ID 0x%02x max_log_proc %d\n", infos->apicid, infos->max_log_proc);
  infos->socketid = infos->apicid / infos->max_log_proc;
  infos->logprocid = infos->apicid % infos->max_log_proc;
  infos->coreid = (unsigned) -1;
  infos->threadid = (unsigned) -1;
  hwloc_debug("phys %d thread %d\n", infos->socketid, infos->logprocid);

  infos->numcaches = 0;
  infos->cache = NULL;

  if (highest_cpuid < 0x04)
    return;

  /* TODO: AMD version */
{'fraction_non_alphanumeric': 0.12169312169312169, 'fraction_numerical': 0.01675485008818342, 'mean_word_length': 3.917630057803468, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 58, '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': '7443073', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1244, 'n_words': 337}