geopm 3.1.1.dev456+g3ba31824
GEOPM - Global Extensible Open Power Manager
Loading...
Searching...
No Matches
geopm_hash.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 - 2024 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#ifndef GEOPM_HASH_H_INCLUDE
6#define GEOPM_HASH_H_INCLUDE
7
8#include <stdint.h>
9#include <string.h>
10
11#include "geopm_public.h"
12
13#ifdef __cplusplus
14#include <string>
15
16extern "C"
17{
18#endif
19
20
21/***************************/
22/* APPLICATION REGION HASH */
23/***************************/
24
25// NOTE: GEOPM_REGION_HASH_* values were derived by hashing the enum
26// string with geopm_crc32_str(). Because the implementation of this
27// hash function has changed, the value will not reproduce, but a
28// similar process can be followed to add any new statically defined
29// region hash values.
33 GEOPM_U64_SENTINEL_REGION_HASH = UINT64_MAX, /* Force enum type to uint64_t */
34};
35
43
44
52uint64_t GEOPM_PUBLIC
53 geopm_crc32_u64(uint64_t begin, uint64_t key);
54
67uint64_t GEOPM_PUBLIC
68 geopm_crc32_str(const char *key);
69
70#ifdef __cplusplus
71}
72
73namespace geopm
74{
75 uint64_t GEOPM_PUBLIC
76 hash(const std::string &key);
77}
78
79#endif
80
81#endif
geopm_region_hash_epoch_e
Enum for internally defined region hashes.
Definition geopm_hash.h:39
@ GEOPM_REGION_HASH_EPOCH
Definition geopm_hash.h:40
@ GEOPM_REGION_HASH_APP
Definition geopm_hash.h:41
uint64_t GEOPM_PUBLIC geopm_crc32_str(const char *key)
This function is used to produce unique region IDs for named regions.
Definition geopm_hash.cpp:32
geopm_region_hash_e
Definition geopm_hash.h:30
@ GEOPM_REGION_HASH_INVALID
Definition geopm_hash.h:31
@ GEOPM_U64_SENTINEL_REGION_HASH
Definition geopm_hash.h:33
@ GEOPM_REGION_HASH_UNMARKED
Definition geopm_hash.h:32
uint64_t GEOPM_PUBLIC geopm_crc32_u64(uint64_t begin, uint64_t key)
DEPRECATED Implements a hashing algorithm.
Definition geopm_hash.cpp:38
#define GEOPM_PUBLIC
Definition geopm_public.h:10
Definition Agg.cpp:20
uint64_t hash(const std::string &key)
Definition geopm_hash.cpp:26