<commit_before>/* 
 * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
 *
 * This software is a computer program whose purpose is to provide
 * abstracted information about the hardware topology.
 *
 * This software is governed by the CeCILL-B license under French law and
 * abiding by the rules of distribution of free software.  You can  use,
 * modify and/ or redistribute the software under the terms of the CeCILL-B
 * license as circulated by CEA, CNRS and INRIA at the following URL
 * "http://www.cecill.info".
 *
 * As a counterpart to the access to the source code and  rights to copy,
 * modify and redistribute granted by the license, users are provided only
 * with a limited warranty  and the software's author,  the holder of the
 * economic rights,  and the successive licensors  have only  limited
 * liability.
 *
 * In this respect, the user's attention is drawn to the risks associated
 * with loading,  using,  modifying and/or developing or reproducing the
 * software by the user in light of its specific status of free software,
 * that may mean  that it is complicated to manipulate,  and  that  also
 * therefore means  that it is reserved for developers  and  experienced
 * professionals having in-depth computer knowledge. Users are therefore
 * encouraged to load and test the software's suitability as regards their
 * requirements in conditions enabling the security of their systems and/or
 * data to be ensured and,  more generally, to use and operate it in the
 * same conditions as regards security.
 *
 * The fact that you are presently reading this means that you have had
 * knowledge of the CeCILL-B license and that you accept its terms.
 */

#ifndef TOPOLOGY_H
#define TOPOLOGY_H

#include <stdio.h>

#include <topology/cpuset.h>


/* \brief Topology context */
struct topo_topology;
typedef struct topo_topology * topo_topology_t;

/* \brief Global information about the topology */
struct topo_topology_info {
  /* topology size */
  unsigned nb_processors;
  unsigned nb_nodes;
  unsigned depth;

  /* machine specifics */
  char *dmi_board_vendor;
  char *dmi_board_name;
  unsigned long huge_page_size_kB;
  int is_fake; /* set if the topology is different from the actual underlying machine */
};

/** \brief Type of topology object.  Do not rely on any relative ordering of the values.  */
enum topo_obj_type_e {
  TOPO_OBJ_SYSTEM,	/**< \brief Whole system (may be a cluster of machines) */
  TOPO_OBJ_MACHINE,	/**< \brief Machine */
  TOPO_OBJ_NODE,	/**< \brief NUMA node */
  TOPO_OBJ_SOCKET,	/**< \brief Socket, physical package, or chip */
  TOPO_OBJ_CACHE,	/**< \brief Cache */
  TOPO_OBJ_CORE,	/**< \brief Core */
  TOPO_OBJ_PROC,	/**< \brief (Logical) Processor (e.g. a thread in a SMT core) */

  TOPO_OBJ_FAKE,	/**< \brief Fake object that may be needed under special circumstances (like arbitrary OS aggregation)  */
};
#define TOPO_OBJ_TYPE_MAX (TOPO_OBJ_FAKE+1)
#define TOPO_OBJ_TYPE_INVALID -1
typedef enum topo_obj_type_e topo_obj_type_t;

/** Structure of a topology object */
struct topo_obj {
  /* physical information */
  enum topo_obj_type_e type;		/**< \brief Type of object */
  signed physical_index;		/**< \brief OS-provided physical index number */

  union topo_obj_attr_u {
    struct topo_cache_attr_u {		/**< \brief Cache-specific attributes */
      unsigned long memory_kB;		  /**< \brief Size of cache */
      unsigned depth;			  /**< \brief Depth of cache */<commit_msg>Remove useless TOPO_OBJ_TYPE_INVALID that shoul...<commit_after>/* 
 * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
 *
 * This software is a computer program whose purpose is to provide
 * abstracted information about the hardware topology.
 *
 * This software is governed by the CeCILL-B license under French law and
 * abiding by the rules of distribution of free software.  You can  use,
 * modify and/ or redistribute the software under the terms of the CeCILL-B
 * license as circulated by CEA, CNRS and INRIA at the following URL
 * "http://www.cecill.info".
 *
 * As a counterpart to the access to the source code and  rights to copy,
 * modify and redistribute granted by the license, users are provided only
 * with a limited warranty  and the software's author,  the holder of the
 * economic rights,  and the successive licensors  have only  limited
 * liability.
 *
 * In this respect, the user's attention is drawn to the risks associated
 * with loading,  using,  modifying and/or developing or reproducing the
 * software by the user in light of its specific status of free software,
 * that may mean  that it is complicated to manipulate,  and  that  also
 * therefore means  that it is reserved for developers  and  experienced
 * professionals having in-depth computer knowledge. Users are therefore
 * encouraged to load and test the software's suitability as regards their
 * requirements in conditions enabling the security of their systems and/or
 * data to be ensured and,  more generally, to use and operate it in the
 * same conditions as regards security.
 *
 * The fact that you are presently reading this means that you have had
 * knowledge of the CeCILL-B license and that you accept its terms.
 */

#ifndef TOPOLOGY_H
#define TOPOLOGY_H

#include <stdio.h>

#include <topology/cpuset.h>


/* \brief Topology context */
struct topo_topology;
typedef struct topo_topology * topo_topology_t;

/* \brief Global information about the topology */
struct topo_topology_info {
  /* topology size */
  unsigned nb_processors;
  unsigned nb_nodes;
  unsigned depth;

  /* machine specifics */
  char *dmi_board_vendor;
  char *dmi_board_name;
  unsigned long huge_page_size_kB;
  int is_fake; /* set if the topology is different from the actual underlying machine */
};

/** \brief Type of topology object.  Do not rely on any relative ordering of the values.  */
enum topo_obj_type_e {
  TOPO_OBJ_SYSTEM,	/**< \brief Whole system (may be a cluster of machines) */
  TOPO_OBJ_MACHINE,	/**< \brief Machine */
  TOPO_OBJ_NODE,	/**< \brief NUMA node */
  TOPO_OBJ_SOCKET,	/**< \brief Socket, physical package, or chip */
  TOPO_OBJ_CACHE,	/**< \brief Cache */
  TOPO_OBJ_CORE,	/**< \brief Core */
  TOPO_OBJ_PROC,	/**< \brief (Logical) Processor (e.g. a thread in a SMT core) */

  TOPO_OBJ_FAKE,	/**< \brief Fake object that may be needed under special circumstances (like arbitrary OS aggregation)  */
};
#define TOPO_OBJ_TYPE_MAX (TOPO_OBJ_FAKE+1)
typedef enum topo_obj_type_e topo_obj_type_t;

/** Structure of a topology object */
struct topo_obj {
  /* physical information */
  enum topo_obj_type_e type;		/**< \brief Type of object */
  signed physical_index;		/**< \brief OS-provided physical index number */

  union topo_obj_attr_u {
    struct topo_cache_attr_u {		/**< \brief Cache-specific attributes */
      unsigned long memory_kB;		  /**< \brief Size of cache */
      unsigned depth;			  /**< \brief Depth of cache */
{'fraction_non_alphanumeric': 0.07877999421798207, 'fraction_numerical': 0.0018791558253830587, 'mean_word_length': 3.719645293315143, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3579326', 'n_tokens_mistral': 2139, 'n_tokens_neox': 2002, 'n_words': 863}