aboutsummaryrefslogtreecommitdiff
path: root/framework/instruments
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-09-01 20:41:12 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commita09de0c8b2ed0f1481502d3b023375609362d9e3 (patch)
treee34b56d9ca69b025d7d9b943cc4df59cd458f6cb /framework/instruments
parent5280071b336d53aff94ca3a6c70ebbe6bf03f4c3 (diff)
downloadComputeLibrary-a09de0c8b2ed0f1481502d3b023375609362d9e3.tar.gz
COMPMID-415: Rename and move tests
The boost validation is now "standalone" in validation_old and builds as arm_compute_validation_old. The new validation builds now as arm_compute_validation. Change-Id: Ib93ba848a25680ac60afb92b461d574a0757150d Reviewed-on: http://mpd-gerrit.cambridge.arm.com/86187 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'framework/instruments')
-rw-r--r--framework/instruments/Instrument.h98
-rw-r--r--framework/instruments/Instruments.cpp59
-rw-r--r--framework/instruments/Instruments.h105
-rw-r--r--framework/instruments/PMUCounter.cpp140
-rw-r--r--framework/instruments/PMUCounter.h71
-rw-r--r--framework/instruments/WallClockTimer.cpp57
-rw-r--r--framework/instruments/WallClockTimer.h53
7 files changed, 0 insertions, 583 deletions
diff --git a/framework/instruments/Instrument.h b/framework/instruments/Instrument.h
deleted file mode 100644
index 895a64738c..0000000000
--- a/framework/instruments/Instrument.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_INSTRUMENT
-#define ARM_COMPUTE_TEST_INSTRUMENT
-
-#include "../Utils.h"
-
-#include <memory>
-#include <ostream>
-#include <string>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Interface for classes that can be used to measure performance. */
-class Instrument
-{
-public:
- /** Helper function to create an instrument of the given type.
- *
- * @return Instance of an instrument of the given type.
- */
- template <typename T>
- static std::unique_ptr<Instrument> make_instrument();
-
- /** Struct representing measurement consisting of value and unit. */
- struct Measurement final
- {
- Measurement(double value, std::string unit)
- : value{ value }, unit{ std::move(unit) }
- {
- }
-
- friend std::ostream &operator<<(std::ostream &os, const Measurement &measurement);
-
- double value;
- std::string unit;
- };
-
- Instrument() = default;
- Instrument(const Instrument &) = default;
- Instrument(Instrument &&) = default;
- Instrument &operator=(const Instrument &) = default;
- Instrument &operator=(Instrument &&) = default;
- virtual ~Instrument() = default;
-
- /** Identifier for the instrument */
- virtual std::string id() const = 0;
-
- /** Start measuring. */
- virtual void start() = 0;
-
- /** Stop measuring. */
- virtual void stop() = 0;
-
- /** Return the latest measurement. */
- virtual Measurement measurement() const = 0;
-};
-
-inline std::ostream &operator<<(std::ostream &os, const Instrument::Measurement &measurement)
-{
- os << measurement.value << measurement.unit;
- return os;
-}
-
-template <typename T>
-inline std::unique_ptr<Instrument> Instrument::make_instrument()
-{
- return support::cpp14::make_unique<T>();
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_INSTRUMENT */
diff --git a/framework/instruments/Instruments.cpp b/framework/instruments/Instruments.cpp
deleted file mode 100644
index 12ad86c70a..0000000000
--- a/framework/instruments/Instruments.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "Instruments.h"
-
-#include "framework/Utils.h"
-
-#include <map>
-#include <stdexcept>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-InstrumentType instrument_type_from_name(const std::string &name)
-{
- static const std::map<std::string, InstrumentType> types =
- {
- { "all", InstrumentType::ALL },
- { "none", InstrumentType::NONE },
- { "wall_clock", InstrumentType::WALL_CLOCK_TIMER },
- { "cycles", InstrumentType::PMU_CYCLE_COUNTER },
- { "instructions", InstrumentType::PMU_INSTRUCTION_COUNTER },
- };
-
- try
- {
- return types.at(tolower(name));
- }
- catch(const std::out_of_range &)
- {
- throw std::invalid_argument(name);
- }
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
diff --git a/framework/instruments/Instruments.h b/framework/instruments/Instruments.h
deleted file mode 100644
index 034fa168f5..0000000000
--- a/framework/instruments/Instruments.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_INSTRUMENTS
-#define ARM_COMPUTE_TEST_INSTRUMENTS
-
-#include "PMUCounter.h"
-#include "WallClockTimer.h"
-
-#include <sstream>
-#include <string>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-enum class InstrumentType : unsigned int
-{
- ALL = ~0U,
- NONE = 0,
- WALL_CLOCK_TIMER = 1,
- PMU_CYCLE_COUNTER = 2,
- PMU_INSTRUCTION_COUNTER = 4
-};
-
-InstrumentType instrument_type_from_name(const std::string &name);
-
-inline InstrumentType operator&(InstrumentType t1, InstrumentType t2)
-{
- using type = std::underlying_type<InstrumentType>::type;
- return static_cast<InstrumentType>(static_cast<type>(t1) & static_cast<type>(t2));
-}
-
-inline InstrumentType operator|(InstrumentType t1, InstrumentType t2)
-{
- using type = std::underlying_type<InstrumentType>::type;
- return static_cast<InstrumentType>(static_cast<type>(t1) | static_cast<type>(t2));
-}
-
-inline InstrumentType &operator|=(InstrumentType &t1, InstrumentType t2)
-{
- using type = std::underlying_type<InstrumentType>::type;
- t1 = static_cast<InstrumentType>(static_cast<type>(t1) | static_cast<type>(t2));
- return t1;
-}
-
-inline ::std::stringstream &operator>>(::std::stringstream &stream, InstrumentType &instrument)
-{
- std::string value;
- stream >> value;
- instrument = instrument_type_from_name(value);
- return stream;
-}
-
-inline ::std::stringstream &operator<<(::std::stringstream &stream, InstrumentType instrument)
-{
- switch(instrument)
- {
- case InstrumentType::WALL_CLOCK_TIMER:
- stream << "WALL_CLOCK_TIMER";
- break;
- case InstrumentType::PMU_CYCLE_COUNTER:
- stream << "PMU_CYCLE_COUNTER";
- break;
- case InstrumentType::PMU_INSTRUCTION_COUNTER:
- stream << "PMU_INSTRUCTION_COUNTER";
- break;
- case InstrumentType::ALL:
- stream << "ALL";
- break;
- case InstrumentType::NONE:
- stream << "NONE";
- break;
- default:
- throw std::invalid_argument("Unsupported instrument type");
- }
-
- return stream;
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_INSTRUMENTS */
diff --git a/framework/instruments/PMUCounter.cpp b/framework/instruments/PMUCounter.cpp
deleted file mode 100644
index 7994a15862..0000000000
--- a/framework/instruments/PMUCounter.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "PMUCounter.h"
-
-#define _GNU_SOURCE 1
-#include <asm/unistd.h>
-#include <csignal>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <fcntl.h>
-#include <linux/hw_breakpoint.h>
-#include <linux/perf_event.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#undef _GNU_SOURCE
-
-#include <stdexcept>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-CycleCounter::CycleCounter()
-{
- const pid_t pid = getpid();
-
- struct perf_event_attr perf_config; //NOLINT
- memset(&perf_config, 0, sizeof(struct perf_event_attr));
-
- perf_config.config = PERF_COUNT_HW_CPU_CYCLES;
- perf_config.size = sizeof(struct perf_event_attr);
- perf_config.type = PERF_TYPE_HARDWARE;
- // The inherit bit specifies that this counter should count events of child
- // tasks as well as the task specified
- perf_config.inherit = 1;
- // Enables saving of event counts on context switch for inherited tasks
- perf_config.inherit_stat = 1;
-
- _fd = syscall(__NR_perf_event_open, &perf_config, pid, -1, -1, 0);
-
- if(_fd < 0)
- {
- throw std::runtime_error("perf_event_open for cycles failed");
- }
-}
-
-std::string CycleCounter::id() const
-{
- return "Cycle Counter";
-}
-
-void CycleCounter::start()
-{
- ioctl(_fd, PERF_EVENT_IOC_RESET, 0);
- ioctl(_fd, PERF_EVENT_IOC_ENABLE, 0);
-}
-
-void CycleCounter::stop()
-{
- ioctl(_fd, PERF_EVENT_IOC_DISABLE, 0);
- read(_fd, &_cycles, sizeof(_cycles));
-}
-
-Instrument::Measurement CycleCounter::measurement() const
-{
- return Measurement(_cycles, "cycles");
-}
-
-InstructionCounter::InstructionCounter()
-{
- const pid_t pid = getpid();
-
- struct perf_event_attr perf_config; //NOLINT
- memset(&perf_config, 0, sizeof(struct perf_event_attr));
-
- perf_config.config = PERF_COUNT_HW_INSTRUCTIONS;
- perf_config.size = sizeof(struct perf_event_attr);
- perf_config.type = PERF_TYPE_HARDWARE;
- // The inherit bit specifies that this counter should count events of child
- // tasks as well as the task specified
- perf_config.inherit = 1;
- // Enables saving of event counts on context switch for inherited tasks
- perf_config.inherit_stat = 1;
-
- _fd = syscall(__NR_perf_event_open, &perf_config, pid, -1, -1, 0);
-
- if(_fd < 0)
- {
- throw std::runtime_error("perf_event_open for instructions failed");
- }
-}
-
-std::string InstructionCounter::id() const
-{
- return "Instruction Counter";
-}
-
-void InstructionCounter::start()
-{
- ioctl(_fd, PERF_EVENT_IOC_RESET, 0);
- ioctl(_fd, PERF_EVENT_IOC_ENABLE, 0);
-}
-
-void InstructionCounter::stop()
-{
- ioctl(_fd, PERF_EVENT_IOC_DISABLE, 0);
- read(_fd, &_instructions, sizeof(_instructions));
-}
-
-Instrument::Measurement InstructionCounter::measurement() const
-{
- return Measurement(_instructions, "instructions");
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
diff --git a/framework/instruments/PMUCounter.h b/framework/instruments/PMUCounter.h
deleted file mode 100644
index f407be602f..0000000000
--- a/framework/instruments/PMUCounter.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_PMU_COUNTER
-#define ARM_COMPUTE_TEST_PMU_COUNTER
-
-#include "Instrument.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Implementation of an instrument to count CPU cycles. */
-class CycleCounter : public Instrument
-{
-public:
- /** Initialise the cycle counter. */
- CycleCounter();
-
- std::string id() const override;
- void start() override;
- void stop() override;
- Measurement measurement() const override;
-
-private:
- long _fd{ -1 };
- long long _cycles{ 0 };
-};
-
-/** Implementation of an instrument to count executed CPU instructions. */
-class InstructionCounter : public Instrument
-{
-public:
- /** Initialise the instruction counter. */
- InstructionCounter();
-
- std::string id() const override;
- void start() override;
- void stop() override;
- Measurement measurement() const override;
-
-private:
- long _fd{ -1 };
- long long _instructions{ 0 };
-};
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_PMU_COUNTER */
diff --git a/framework/instruments/WallClockTimer.cpp b/framework/instruments/WallClockTimer.cpp
deleted file mode 100644
index 37db0c7f05..0000000000
--- a/framework/instruments/WallClockTimer.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "WallClockTimer.h"
-
-#include "../Framework.h"
-#include "../Utils.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-std::string WallClockTimer::id() const
-{
- return "Wall clock";
-}
-
-void WallClockTimer::start()
-{
- _start = std::chrono::high_resolution_clock::now();
-}
-
-void WallClockTimer::stop()
-{
- _stop = std::chrono::high_resolution_clock::now();
-}
-
-Instrument::Measurement WallClockTimer::measurement() const
-{
- const auto delta = std::chrono::duration_cast<std::chrono::microseconds>(_stop - _start);
- return Instrument::Measurement(delta.count(), "us");
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
diff --git a/framework/instruments/WallClockTimer.h b/framework/instruments/WallClockTimer.h
deleted file mode 100644
index b7c390f691..0000000000
--- a/framework/instruments/WallClockTimer.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_WALL_CLOCK_TIMER
-#define ARM_COMPUTE_TEST_WALL_CLOCK_TIMER
-
-#include "Instrument.h"
-
-#include <chrono>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Implementation of an instrument to measure elapsed wall-clock time in milliseconds. */
-class WallClockTimer : public Instrument
-{
-public:
- std::string id() const override;
- void start() override;
- void stop() override;
- Measurement measurement() const override;
-
-private:
- std::chrono::high_resolution_clock::time_point _start{};
- std::chrono::high_resolution_clock::time_point _stop{};
-};
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_WALL_CLOCK_TIMER */