Program Listing for File rttest.h
↰ Return to documentation for file (include/rttest/rttest.h
)
// Copyright 2015 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef RTTEST__RTTEST_H_
#define RTTEST__RTTEST_H_
#include <time.h>
#include <sched.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
// rttest can have one instance per thread!
struct rttest_params
{
size_t iterations;
struct timespec update_period;
size_t sched_policy;
int sched_priority;
size_t stack_size;
uint64_t prefault_dynamic_size;
// TODO(dirk-thomas) currently this pointer is never deallocated or copied
// so whatever value is being assigned must stay valid forever
char * filename;
};
struct rttest_results
{
// Max iteration that this result describes
size_t iteration;
int64_t min_latency;
int64_t max_latency;
double mean_latency;
double latency_stddev;
size_t minor_pagefaults;
size_t major_pagefaults;
};
int rttest_read_args(int argc, char ** argv);
int rttest_init(
size_t iterations, struct timespec update_period,
size_t sched_policy, int sched_priority, size_t stack_size,
uint64_t prefault_dynamic_size, char * filename);
int rttest_get_params(struct rttest_params * params);
int rttest_init_new_thread();
int rttest_spin(void * (*user_function)(void *), void * args);
// TODO(jacquelinekay) better signature for user function
int rttest_spin_period(
void * (*user_function)(void *), void * args,
const struct timespec * update_period, const size_t iterations);
int rttest_spin_once_period(
void * (*user_function)(void *), void * args,
const struct timespec * start_time,
const struct timespec * update_period, const size_t i);
int rttest_spin_once(
void * (*user_function)(void *), void * args,
const struct timespec * start_time, const size_t i);
int rttest_lock_memory();
int rttest_prefault_stack_size(const size_t stack_size);
int rttest_prefault_stack();
int rttest_lock_and_prefault_dynamic();
int rttest_set_sched_priority(const size_t sched_priority, const int policy);
int rttest_set_thread_default_priority();
int rttest_get_next_rusage(size_t i);
int rttest_calculate_statistics(struct rttest_results * results);
int rttest_get_statistics(struct rttest_results * results);
int rttest_get_sample_at(const size_t iteration, int64_t * sample);
int rttest_write_results();
int rttest_write_results_file(char * filename);
int rttest_finish();
int rttest_running();
#ifdef __cplusplus
}
#endif
#endif // RTTEST__RTTEST_H_