SpiNNFrontEndCommon 7.1.1
Common support code for user-facing front end systems.
Loading...
Searching...
No Matches
profiler.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 The University of Manchester
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
20
21#include <stdint.h>
22#include <debug.h>
23#include <profiler.h>
24#include <spinnaker.h>
25
26//---------------------------------------
27// Globals
28//---------------------------------------
30
31//---------------------------------------
32// Functions
33//---------------------------------------
34void profiler_init(uint32_t* data_region) {
35 log_info("Reading profile setup from 0x%08x", data_region);
36 profiler_state.samples_remaining = data_region[0];
37 profiler_state.count = &data_region[0];
38 profiler_state.output = &data_region[1];
39
40 log_info("Initialising profiler with storage for %u samples starting at 0x%08x",
42
43 // If profiler is turned on, start timer 2 with no clock divider
45 tc[T2_CONTROL] = 0x82;
46 tc[T2_LOAD] = 0;
47 }
48}
49
50//---------------------------------------
52 uint32_t words_written = (profiler_state.output - profiler_state.count) - 1;
53 *profiler_state.count = words_written;
54 log_info("Profiler wrote %u bytes to 0x%08x",
55 (words_written * 4) + 4, profiler_state.count);
56}
SpiNNaker debug header file.
void log_info(const char *message,...)
This function logs informational messages. This is the lowest level of message normally printed.
void profiler_init(uint32_t *data_region)
Initialise the profiler from a SDRAM region.
Definition profiler.c:34
void profiler_finalise(void)
Finalises profiling.
Definition profiler.c:51
Support for code profiling.
uint32_t samples_remaining
How many samples can be written before space is exhausted.
Definition profiler.h:63
uint32_t * output
Points to where the next sample will be written.
Definition profiler.h:65
uint32_t * count
Points to where the profiling data starts being stored.
Definition profiler.h:61
The internal state of the profiler.
Definition profiler.h:59
#define T2_CONTROL
#define T2_LOAD