Skip to content

Commit e8b0c69

Browse files
[arcane,utils] Déplace 'platform::getPageSize()' de 'arccore' vers 'arcane'.
1 parent 2ca8560 commit e8b0c69

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

arcane/src/arcane/utils/PlatformUtils.cc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
22
//-----------------------------------------------------------------------------
3-
// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
3+
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
44
// See the top-level COPYRIGHT file for details.
55
// SPDX-License-Identifier: Apache-2.0
66
//-----------------------------------------------------------------------------
77
/*---------------------------------------------------------------------------*/
8-
/* PlatformUtils.cc (C) 2000-2023 */
8+
/* PlatformUtils.cc (C) 2000-2024 */
99
/* */
1010
/* Fonctions utilitaires dépendant de la plateforme. */
1111
/*---------------------------------------------------------------------------*/
@@ -525,6 +525,25 @@ getRealTimeNS()
525525
/*---------------------------------------------------------------------------*/
526526
/*---------------------------------------------------------------------------*/
527527

528+
extern "C++" ARCANE_UTILS_EXPORT Int64 platform::
529+
getPageSize()
530+
{
531+
#if defined(ARCCORE_OS_WIN32)
532+
SYSTEM_INFO si;
533+
GetSystemInfo(&si);
534+
return si.dwPageSize;
535+
#elif defined(ARCANE_OS_LINUX)
536+
return ::sysconf(_SC_PAGESIZE);
537+
#else
538+
#warning "getPageSize() not implemented for your platform. Default is 4096"
539+
Int64 page_size = 4096;
540+
return page_size;
541+
#endif
542+
}
543+
544+
/*---------------------------------------------------------------------------*/
545+
/*---------------------------------------------------------------------------*/
546+
528547
namespace
529548
{
530549
void (*global_garbage_collector_delegate)() = nullptr;

arcane/src/arcane/utils/PlatformUtils.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,14 @@ getLoadedSharedLibraryFullPath(const String& dll_name);
384384
extern "C++" ARCANE_UTILS_EXPORT void
385385
fillCommandLineArguments(StringList& arg_list);
386386

387+
/*---------------------------------------------------------------------------*/
388+
/*---------------------------------------------------------------------------*/
389+
/*!
390+
* \brief Taille des pages du système hôte en octets
391+
*/
392+
extern "C++" ARCANE_UTILS_EXPORT Int64
393+
getPageSize();
394+
387395
/*---------------------------------------------------------------------------*/
388396
/*---------------------------------------------------------------------------*/
389397

arcane/src/arcane/utils/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
TestHash.cc
88
TestHashTable.cc
99
TestMemory.cc
10+
TestPlatform.cc
1011
TestVector2.cc
1112
TestVector3.cc
1213
)

0 commit comments

Comments
 (0)