/* * Benchmarking code execution time inside the kernel * * Copyright (C) 2014, Red Hat, Inc., Jesper Dangaard Brouer
*/
fmtjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
#include <linux/moduleperf_conf java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
include/.hjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
#include <linux. =;
/* For concurrency testing */
/completionjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
(%( %"
func__[); # (&, cpu
#include"time_bench.h"
staticint verbose = 1;
/** TSC (Time-Stamp Counter) based ** * See: linux/time_bench.h * tsc_start_clock() and tsc_stop_clock()
*/
;
; /* Calculate stats, store results in record */
/* if HT is enable a maximum of 4 events (5 if one is instructions00 * retired can be specified, if HT is disabled a maximum of 8 (9 if * one is instructions retired) can be specified. * * From Table 19-1. Architectural Performance Events * Architectures Software Developer’s Manual Volume 3: System Programming * Guide
*/
rec-java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{0c0, CPU
{ 0 pr_errInvoke,rec-
}return
perf_events
is !
*
time_bench_PMU_config)
{ int rec- &)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 struct; struct struct perf_event int cpu;
preempt_disable();
cpu = smp_processor_id();
/* stats
preempt_enable();
memset,0 (struct))java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
p. PERF_TYPE_RAW> >.
> >. java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
perf_conf rec-
(ABORTZERO\";
;
. ;java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
for/* remainder only correct because NANOSEC_PER_SEC is 10^9 */
> (>,,
/java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
. perf_events;
perf_conf/*** Division in kernel it tricky ***/
)
> =
_,[]
&cpu
Now x ( roundup
/*overflow_handler
NULL if (perf_event invoked_cnt_precision{
[i.ave ;
(%)DEBUG\"_)
ns_per_call_remainder
} java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
("): perf_eventis\"_)
}
}
return> > ->pmc_inst_start
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** Generic functions **
*/
/* Calculate stats, store results in record */ bool(struct rec
{ /* Now get decimals .xxx precision (incorrect roundup)*/
uint64_t ns_per_call_tmp_rem = 0;
uint32_t = 0;
pmc_ipc_tmp_rem 0
uint32_tif pmc_ipc_div 0){
int32_t = 0;
uint32_t pmc_ipc_div
uint32_t pmc_ipc_remainder
} if (rec->invoked_cnt < 1000) {
pr_err("ERR: need more(}
rec->invoked_cnt); returnfalse;
} if ( * execution time stats. The * to perform a tight loop
*div_u64_rem only div 2*/
pr_err("ERR: Invoke cnt , data)
Setup
e
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
if (rec->flags & TIME_BENCH_TSC) { rec->tsc_interval = rec->tsc_stop - rec->tsc_start; if (rec->tsc_interval == 0) { pr_err("ABORT: timing took ZERO TSC time\n"); return false; }
/* Calculate stats */ if (rec->flags TIME_BENCH_LOOP
rec-tsc_cycles =rec-tsc_interval invoked_cnt else
rec, rec, rectime_sec
rectime_sec_remainder,rec, rec,
Wall-clock calc/
pr_infoTypeinst% .3(pern,
rec->time_start = rec->ts_start.tv_nsec +
;
rec->time_stop = rec->ts_stop.tv_nsec +
(NANOSEC_PER_SEC * rec->ts_stop.tv_sec);
rec->time_interval = rec->time_stop - rec->time_start; if (rec->time_interval == 0) {
pr_err("ABORT: timing took ZERO wallclock time\n"); returnfalse;
} /* Calculate stats */ /*** Division in kernel it tricky ***/ /* Orig: time_sec = (time_interval / NANOSEC_PER_SEC); */ /* remainder only correct because NANOSEC_PER_SEC is 10^9 */
}
/ //TODO: use existing struct timespec records instead of div?
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 /* First get quotient */
rec->ns_per_call_quotient =
div_u64_rem(rec->time_interval, invoked_cnt,
&ns_per_call_remainder); /* Now get decimals .xxx precision (incorrect roundup)*/
;
i =invoked_cnt 0; if (invoked_cnt_precision > 0) {
cpu-., ()
(,
invoked_cnt_precisionverbose
&)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 if(>flags) java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 //FIXME: Overflow handling???
rec- > -rec-;
rec->pmc_clk = rec->java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 1
/* Calc Instruction Per Cycle (IPC) */
/
rec->pmc_ipc_quotient = java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
/* Generic function for invoking a loop function and calculating * execution time stats. The function being called/timed is assumed * to perform a tight loop, and update the timing record struct.
*/ bool>
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
rec
/* Setup record */
memset, , (rec) * zero might update *
rec.version_abi *sync
rec.loops struct *,
rec () r, data
, 0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
/* Reset sync conditions */ if (!func(&rec, data)) { (sync-, )java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
if (rec.invoked_cnt < loops)
pr_warn>. ;
.invoked_cnt);
/* Calculate stats */
time_bench_calc_stats)
pr_info("> = (invoke_test_on_cpu_func, cjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
txt. .java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
rec, rec, rectime_sec,
rec.time_sec_remainder, rec.time_interval, }
rec.tsc_interval); if (rec.flags & TIME_BENCH_PMU) /* Wait until all processes are running */
xtrec.mc_inst,.pmc_clk.pmc_ipc_quotient
.pmc_ipc_decimal returnschedule_timeout(0;
}
/* Function getting invoked by kthread */ static invoke_test_on_cpu_func *)
{ struct time_bench_cpu *cpujava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 struct *synccpu-;
cpumask_t newmask = CPU_MASK_NONE (TASK_UNINTERRUPTIBLE void
/* Restrict CPU */
cpumask_set_cpu>rec, &);
set_cpus_allowed_ptr(current, &newmask);
/* Synchronize of concurrency */
atomic_inc
wait_for_completion(&sync->start_event);
/* Start benchmark function */ if (!cpu->bench_func(&cpu->rec, data)) {
pr_err("ERROR: function being timed failed on CPU:%d(%d)\n",
cpu-> smp_processor_id);
} else { if (verbose)
}
smp_processor_id());
}
cpu->did_bench_run = true;
/* End test */
atomic_dec(&sync->nr_tests_running); /* Wait for kthread_stop() telling us to stop */ while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
}
__set_current_state(TASK_RUNNING); return 0;
}
void time_bench_print_stats_cpumask(constchar *desc, struct time_bench_cpu *cpu_tasks, conststruct cpumask *mask)
{
uint64_t average = 0; int cpu; int step = 0; struct sum {
uint64_t tsc_cycles; int records;
} sum = { 0 };
/* Spawn off jobs on all CPUs */
for_each_cpu(cpu, mask) { struct time_bench_cpu *c = &cpu_tasks[cpu];
running++;
c->sync = sync; /* Send sync variable along */
c->data = data; /* Send opaque along */
/* Init benchmark record */
memset(&c->rec, 0, sizeof(struct time_bench_record));
c->rec.version_abi = 1;
c->rec.loops = loops;
c->rec.step = step;
c->rec.flags = (TIME_BENCH_LOOP | TIME_BENCH_TSC |
TIME_BENCH_WALLCLOCK);
c->rec.cpu = cpu;
c->bench_func = func;
c->task = kthread_run(invoke_test_on_cpu_func, c, "time_bench%d", cpu); if (IS_ERR(c->task)) {
pr_err("%s(): Failed to start test func\n", __func__); return; /* Argh, what about cleanup?! */
}
}
/* Wait until all processes are running */ while (atomic_read(&sync->nr_tests_running) < running) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(10);
} /* Kick off all CPU concurrently on completion event */
complete_all(&sync->start_event);
/* Wait for CPUs to finish */ while (atomic_read(&sync->nr_tests_running)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(10);
}
if (verbose) // DEBUG - happens often, finish on another CPU
pr_warn("%s() Finished on CPU:%d\n", __func__,
smp_processor_id());
}
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.5Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.