summaryrefslogtreecommitdiff
path: root/support/dktools/dk3cores.h
blob: 36b0db0c7e389c8e5dfcdbe83a16618f4742ebc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
	WARNING: This file was generated by dkct.
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: dk3cores.ctr
*/

/**	@file dk3cores.h Header file for the dk3cores module.
*/

#ifndef DK3CORES_H_INCLUDED
/** Avoid multiple inclusions. */
#define DK3CORES_H_INCLUDED 1


#line 4 "dk3cores.ctr"

/**	@defgroup	coressrc	Source for cores information
*/
/**@{*/

/**	No information found.
*/
#define	DK3_CORES_SRC_NONE		(-1)

/**	System call succeeded.
*/
#define	DK3_CORES_SRC_SYSTEM		0

/**	Environment variable NUMBER_OF_PROCESSORS on Windows.
*/
#define	DK3_CORES_SRC_ENVIRONMENT	1

/**	File /proc/cpuinfo on *x systems.
*/
#define	DK3_CORES_SRC_CPUINFO		2

/**	The /threads/max preference.
*/
#define	DK3_CORES_SRC_PREFERENCE	3

/**@}*/

#ifdef __cplusplus
extern "C" {
#endif

/**	Retrieve number of processor cores on system.
	@param	src	Pointer to information source indicator variable,
			may be NULL.
	@return	Number of processor cores found.
*/
size_t
dk3cores_get_num(int *src);

/**	Check whether we run on WOW6432.
	@return	1 for WOW6432, 0 otherwise.
*/
int
dk3cores_is_wow64(void);

/**	Get maximum number of threads.
	The number is retrieved from the /threads/max preference if
	available, or derived from the number of cores available
	(back = (n > 2) ? (n - 1) : 1) to leave one core for
	GUI or desktop session.
	@param	app	Application to use for preferences retrieval.
	@param	src	Pointer to information source indicator variable,
			may be NULL.
	@return	Number of threas to use maximally.
*/
size_t
dk3cores_max_threads(dk3_app_t *app, int *src);

#ifdef __cplusplus
}
#endif


#endif