Project
Loading...
Searching...
No Matches
ComputingResourceHelpers.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
12#include <thread>
13#include <unistd.h>
14#include <sstream>
15
16namespace o2::framework
17{
19{
20 long pages = sysconf(_SC_PHYS_PAGES);
21 long page_size = sysconf(_SC_PAGE_SIZE);
22 return pages * page_size;
23};
24
26{
28 result.cpu = std::thread::hardware_concurrency(),
30 result.hostname = "localhost";
31 result.startPort = 22000;
32 result.lastPort = 27000;
33 result.usedPorts = 0;
34 return result;
35}
36
37std::vector<ComputingResource> ComputingResourceHelpers::parseResources(std::string const& resourceString)
38{
39 std::vector<ComputingResource> resources;
40 std::istringstream str{resourceString};
41 std::string result;
42 while (std::getline(str, result, ',')) {
43 std::istringstream in{result};
44 char colon;
45 ComputingResource resource;
46 std::getline(in, resource.hostname, ':');
47 in >> resource.cpu >> colon >> resource.memory >> colon >> resource.startPort >> colon >> resource.lastPort;
48 resource.memory = resource.memory * 1000000;
49 resource.usedPorts = 0;
50 resources.emplace_back(resource);
51 }
52 return resources;
53}
54
55} // namespace o2::framework
GLuint64EXT * result
Definition glcorearb.h:5662
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
static std::vector< ComputingResource > parseResources(std::string const &resourceString)
A computing resource which can be offered to run a device.
const std::string str