本文整理汇总了C++中TIMER函数的典型用法代码示例。如果您正苦于以下问题:C++ TIMER函数的具体用法?C++ TIMER怎么用?C++ TIMER使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TIMER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: time_get
double time_get(double *src_buf, double *dst_buf, int chunk, int loop,
int proc, int levels)
{
int i, bal = 0;
int stride[2];
int count[2];
int stride_levels = levels;
double *tmp_buf, *tmp_buf_ptr;
double start_time, stop_time, total_time = 0;
stride[0] = SIZE * sizeof(double);
count[0] = chunk * sizeof(double); count[1] = chunk;
if(CHECK_RESULT) {
tmp_buf = (double *)malloc(SIZE * SIZE * sizeof(double));
assert(tmp_buf != NULL);
fill_array(tmp_buf, SIZE*SIZE, proc);
tmp_buf_ptr = tmp_buf;
}
start_time = TIMER();
for(i=0; i<loop; i++) {
if(levels)
A1_GetS(proc, stride_levels, count, src_buf, stride, dst_buf, stride);
else
A1_Get(proc, src_buf, dst_buf, count[0]);
if(CHECK_RESULT) {
sprintf(check_type, "A1_GetS:");
check_result(tmp_buf_ptr, dst_buf, stride, count, stride_levels);
}
/* prepare next src and dst ptrs: avoid cache locality */
if(bal == 0) {
src_buf += 128;
dst_buf += 128;
if(CHECK_RESULT) tmp_buf_ptr += 128;
bal = 1;
} else {
src_buf -= 128;
dst_buf -= 128;
if(CHECK_RESULT) tmp_buf_ptr -= 128;
bal = 0;
}
}
stop_time = TIMER();
total_time = (stop_time - start_time);
if(CHECK_RESULT) free(tmp_buf);
if(total_time == 0.0){
total_time=0.000001; /* workaround for inaccurate timers */
warn_accuracy++;
}
return(total_time/loop);
}
示例2: main
int main(){
/*@todo:
* posix_memalign((void**)&a, 16, N * sizeof(float)); e criar matrizes dinamicas na heap
* explicitas alinhadas. Lembrar que podemos ter certa perda de performance.
*
* */
criarGrafoAleatorio();
memcpy(G_BK,G,sizeof(G));
{
TIMER("\nNormal");
cliqueNormal();
}
memcpy(G,G_BK,sizeof(G_BK));
{
TIMER("\n Russian DOll");
MWNonRecursiveRussianDoll();
}
return 0;
}
示例3: timer_fd_handler
static void
timer_fd_handler (int fd)
{
int dummy;
int ready, i;
repv *timers;
rep_GC_n_roots gc_timers;
Lisp_Timer *t;
sigset_t old;
read (pipe_fds[0], &dummy, sizeof (dummy));
sigprocmask (SIG_BLOCK, &alrm_sigset, &old);
ready = 0;
for (t = timer_chain; t != 0 && t->fired; t = t->next)
ready++;
timers = alloca (sizeof (repv) * ready);
for (i = 0; i < ready; i++)
{
timers[i] = rep_VAL(timer_chain);
timer_chain = timer_chain->next;
}
setup_next_timer ();
sigprocmask (SIG_SETMASK, &old, 0);
rep_PUSHGCN(gc_timers, timers, ready);
for (i = 0; i < ready; i++)
{
if (!TIMER(timers[i])->deleted)
rep_call_lisp1 (TIMER(timers[i])->function, timers[i]);
}
rep_POPGCN;
}
示例4: DISCRETE
void bally_as2888_device::device_add_mconfig(machine_config &config)
{
DISCRETE(config, m_discrete, as2888_discrete);
m_discrete->add_route(ALL_OUTPUTS, *this, 1.00, AUTO_ALLOC_INPUT, 0);
TIMER(config, "timer_s_freq").configure_periodic(FUNC(bally_as2888_device::timer_s), attotime::from_hz(353000)); // Inverter clock on AS-2888 sound board
TIMER(config, m_snd_sustain_timer).configure_generic(FUNC(bally_as2888_device::timer_as2888));
}
示例5: dump_frc1_seq
IRAM void dump_frc1_seq(void)
{
uint32_t f1_a = TIMER(0).COUNT;
uint32_t f1_b = TIMER(0).COUNT;
uint32_t f1_c = TIMER(0).COUNT;
printf("FRC1 sequence 0x%08lx 0x%08lx 0x%08lx\r\n", f1_a, f1_b, f1_c);
printf("FRC1 deltas %ld %ld \r\n", f1_b-f1_a, f1_c-f1_b);
}
示例6: frc2_handler
void frc2_handler(void)
{
frc2_handler_call_count++;
frc2_last_count_val = TIMER(1).COUNT;
TIMER(1).ALARM = frc2_last_count_val + 0x100000;
//TIMER(1).LOAD = 0;
//TIMER(1).LOAD = 0x2000000;
//TIMER(1).STATUS = 0;
}
示例7: V30
void deadang_state::deadang(machine_config &config)
{
/* basic machine hardware */
V30(config, m_maincpu, XTAL(16'000'000)/2); /* Sony 8623h9 CXQ70116D-8 (V30 compatible) */
m_maincpu->set_addrmap(AS_PROGRAM, &deadang_state::main_map);
TIMER(config, "scantimer1").configure_scanline(FUNC(deadang_state::main_scanline), "screen", 0, 1);
V30(config, m_subcpu, XTAL(16'000'000)/2); /* Sony 8623h9 CXQ70116D-8 (V30 compatible) */
m_subcpu->set_addrmap(AS_PROGRAM, &deadang_state::sub_map);
TIMER(config, "scantimer2").configure_scanline(FUNC(deadang_state::sub_scanline), "screen", 0, 1);
Z80(config, m_audiocpu, XTAL(14'318'181)/4);
m_audiocpu->set_addrmap(AS_PROGRAM, &deadang_state::sound_map);
m_audiocpu->set_addrmap(AS_OPCODES, &deadang_state::sound_decrypted_opcodes_map);
m_audiocpu->set_irq_acknowledge_callback("seibu_sound", FUNC(seibu_sound_device::im0_vector_cb));
SEI80BU(config, "sei80bu", 0).set_device_rom_tag("audiocpu");
config.m_minimum_quantum = attotime::from_hz(60); // the game stops working with higher interleave rates..
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
m_screen->set_size(32*8, 32*8);
m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
m_screen->set_screen_update(FUNC(deadang_state::screen_update));
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_deadang);
PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
SEIBU_SOUND(config, m_seibu_sound, 0);
m_seibu_sound->int_callback().set_inputline(m_audiocpu, 0);
m_seibu_sound->set_rom_tag("audiocpu");
m_seibu_sound->set_rombank_tag("seibu_bank1");
m_seibu_sound->ym_read_callback().set("ym1", FUNC(ym2203_device::read));
m_seibu_sound->ym_write_callback().set("ym1", FUNC(ym2203_device::write));
ym2203_device &ym1(YM2203(config, "ym1", XTAL(14'318'181)/4));
ym1.irq_handler().set("seibu_sound", FUNC(seibu_sound_device::fm_irqhandler));
ym1.add_route(ALL_OUTPUTS, "mono", 0.15);
ym2203_device &ym2(YM2203(config, "ym2", XTAL(14'318'181)/4));
ym2.add_route(ALL_OUTPUTS, "mono", 0.15);
SEIBU_ADPCM(config, m_adpcm1, 8000).add_route(ALL_OUTPUTS, "mono", 0.40);
SEIBU_ADPCM(config, m_adpcm2, 8000).add_route(ALL_OUTPUTS, "mono", 0.40);
}
示例8: Z80
void mc1000_state::mc1000(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_maincpu, 3579545);
m_maincpu->set_addrmap(AS_PROGRAM, &mc1000_state::mc1000_mem);
m_maincpu->set_addrmap(AS_OPCODES, &mc1000_state::mc1000_banking_mem);
m_maincpu->set_addrmap(AS_IO, &mc1000_state::mc1000_io);
/* timers */
timer_device &ne555clear(TIMER(config, "ne555clear"));
ne555clear.configure_periodic(FUNC(mc1000_state::ne555_tick), attotime::from_hz(MC1000_NE555_FREQ));
ne555clear.config_param(CLEAR_LINE);
timer_device &ne555assert(TIMER(config, "ne555assert"));
ne555assert.configure_periodic(FUNC(mc1000_state::ne555_tick), attotime::from_hz(MC1000_NE555_FREQ));
ne555assert.set_start_delay(attotime::from_hz(MC1000_NE555_FREQ * 100 / MC1000_NE555_DUTY_CYCLE));
ne555assert.config_param(ASSERT_LINE);
/* video hardware */
SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER);
MC6847_NTSC(config, m_vdg, XTAL(3'579'545));
m_vdg->hsync_wr_callback().set(FUNC(mc1000_state::hs_w));
m_vdg->fsync_wr_callback().set(FUNC(mc1000_state::fs_w));
m_vdg->input_callback().set(FUNC(mc1000_state::videoram_r));
m_vdg->set_screen(SCREEN_TAG);
/* sound hardware */
SPEAKER(config, "mono").front_center();
ay8910_device &ay8910(AY8910(config, AY8910_TAG, 3579545/2));
ay8910.set_flags(AY8910_SINGLE_OUTPUT);
ay8910.set_resistors_load(RES_K(2.2), 0, 0);
ay8910.port_b_read_callback().set(FUNC(mc1000_state::keydata_r));
ay8910.port_a_write_callback().set(FUNC(mc1000_state::keylatch_w));
ay8910.add_route(ALL_OUTPUTS, "mono", 0.25);
/* devices */
CASSETTE(config, m_cassette);
m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
m_cassette->set_interface("mc1000_cass");
SOFTWARE_LIST(config, "cass_list").set_original("mc1000_cass");
CENTRONICS(config, m_centronics, centronics_devices, "printer");
m_centronics->busy_handler().set(FUNC(mc1000_state::write_centronics_busy));
output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
m_centronics->set_output_latch(latch);
/* internal ram */
RAM(config, RAM_TAG).set_default_size("16K").set_extra_options("48K");
}
示例9: main
int main()
{
const int nreps = 100;
const int n = 5000;
double *x;
x = gen_runif2(n*n);
TIMER(symmetrize_naive(n, x), nreps);
TIMER(symmetrize(n, x), nreps);
return COOP_OK;
}
示例10: MC6809E
void icecold_state::icecold(machine_config &config)
{
/* basic machine hardware */
MC6809E(config, m_maincpu, XTAL(6'000'000)/4); // 68A09E
m_maincpu->set_addrmap(AS_PROGRAM, &icecold_state::icecold_map);
pia6821_device &pia0(PIA6821(config, "pia0", 0));
pia0.readpa_handler().set_ioport("JOY");
pia0.readpb_handler().set_ioport("DSW3");
pia0.irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE);
pia0.irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE);
PIA6821(config, m_pia1, 0);
m_pia1->readpa_handler().set(FUNC(icecold_state::ay_r));
m_pia1->writepa_handler().set(FUNC(icecold_state::ay_w));
m_pia1->writepb_handler().set(FUNC(icecold_state::snd_ctrl_w));
m_pia1->irqa_handler().set_inputline("maincpu", M6809_FIRQ_LINE);
m_pia1->irqb_handler().set_inputline("maincpu", M6809_FIRQ_LINE);
pia6821_device &pia2(PIA6821(config, "pia2", 0));
pia2.irqa_handler().set_inputline("maincpu", M6809_IRQ_LINE);
pia2.irqb_handler().set_inputline("maincpu", M6809_IRQ_LINE);
i8279_device &kbdc(I8279(config, "i8279", XTAL(6'000'000)/4));
kbdc.out_irq_callback().set("pia0", FUNC(pia6821_device::cb1_w)); // irq
kbdc.out_sl_callback().set(FUNC(icecold_state::scanlines_w)); // scan SL lines
kbdc.out_disp_callback().set(FUNC(icecold_state::digit_w)); // display A&B
kbdc.in_rl_callback().set(FUNC(icecold_state::kbd_r)); // kbd RL lines
// 30Hz signal from CH-C of ay0
TIMER(config, "sint_timer", 0).configure_periodic(timer_device::expired_delegate(FUNC(icecold_state::icecold_sint_timer), this), attotime::from_hz(30));
// for update motors position
TIMER(config, "motors_timer", 0).configure_periodic(timer_device::expired_delegate(FUNC(icecold_state::icecold_motors_timer), this), attotime::from_msec(50));
// video hardware
config.set_default_layout(layout_icecold);
// sound hardware
SPEAKER(config, "mono").front_center();
AY8910(config, m_ay8910[0], XTAL(6'000'000)/4);
m_ay8910[0]->port_a_read_callback().set_ioport("DSW4");
m_ay8910[0]->port_b_write_callback().set(FUNC(icecold_state::ay8910_0_b_w));
m_ay8910[0]->add_route(ALL_OUTPUTS, "mono", 0.25);
AY8910(config, m_ay8910[1], XTAL(6'000'000)/4);
m_ay8910[1]->port_a_write_callback().set(FUNC(icecold_state::ay8910_1_a_w));
m_ay8910[1]->port_b_write_callback().set(FUNC(icecold_state::ay8910_1_b_w));
m_ay8910[1]->add_route(ALL_OUTPUTS, "mono", 0.25);
}
示例11: lblMuonPartPointSrc
qlat::SpinMatrix lblMuonPartPointSrc(
const qlat::Geometry& geo, const int tsnk, const int tsrc,
const qlat::Coordinate& xg1, const int mu1, const qlat::Coordinate& xg2,
const int mu2, const qlat::Coordinate& xg3, const int mu3,
const double mass, const std::array<double, qlat::DIMN>& momtwist)
{
TIMER("lblMuonPartPointSrc");
qlat::QedGaugeField egf1;
egf1.init(geo);
qlat::QedGaugeField egf2;
egf2.init(geo);
qlat::QedGaugeField egf3;
egf3.init(geo);
qlat::set_zero(egf1);
qlat::set_zero(egf2);
qlat::set_zero(egf3);
qlat::set_point_source_plusm(egf1, 1.0, xg1, mu1);
qlat::set_point_source_plusm(egf2, 1.0, xg2, mu2);
qlat::set_point_source_plusm(egf3, 1.0, xg3, mu3);
// ADJUST ME
qlat::prop_photon_invert(egf1, momtwist);
qlat::prop_photon_invert(egf2, momtwist);
qlat::prop_photon_invert(egf3, momtwist);
// ADJUST ME
// return lblMuonLine(tsnk, tsrc, egf1, egf2, egf3, mass, momtwist);
return lblMuonLineC(tsnk, tsrc, egf1, egf2, egf3, mass, momtwist);
}
示例12: installTimer
void BSpit::checkYtramCatch(bool playSound) {
// Check if we've caught a Ytram
uint32 &ytramTime = _vm->_vars["bytramtime"];
// The trap has been moved back up.
// You can't catch those sneaky Ytrams that way.
if (ytramTime == 0) {
return;
}
// If the trap still has not gone off, reinstall our timer
// This is in case you set the trap, walked away, and returned
if (_vm->getTotalPlayTime() < ytramTime) {
installTimer(TIMER(BSpit, ytramTrapTimer), ytramTime - _vm->getTotalPlayTime());
return;
}
// Increment the movie per catch (max = 3)
uint32 &ytramMovie = _vm->_vars["bytram"];
ytramMovie++;
if (ytramMovie > 3)
ytramMovie = 3;
// Reset variables
_vm->_vars["bytrapped"] = 1;
_vm->_vars["bbait"] = 0;
_vm->_vars["bytrap"] = 0;
ytramTime = 0;
// Play the capture sound, if requested
if (playSound)
_vm->_sound->playSound(33);
}
示例13: Z80
void gundealr_state::gundealr(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_maincpu, XTAL(12'000'000)/2); /* 6 MHz verified for Yam! Yam!? */
m_maincpu->set_addrmap(AS_PROGRAM, &gundealr_state::gundealr_main_map);
m_maincpu->set_addrmap(AS_IO, &gundealr_state::main_portmap);
TIMER(config, "scantimer").configure_scanline(FUNC(gundealr_state::scanline), "screen", 0, 1);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(32*8, 32*8);
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
screen.set_screen_update(FUNC(gundealr_state::screen_update));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gundealr);
PALETTE(config, m_palette).set_entries(512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
YM2203(config, "ymsnd", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "mono", 0.25); /* 1.5Mhz verified for Yam! Yam!? */
}
示例14: TMP68301
void csplayh5_state::csplayh5(machine_config &config)
{
/* basic machine hardware */
TMP68301(config, m_maincpu, 16000000); /* TMP68301-16 */
m_maincpu->set_addrmap(AS_PROGRAM, &csplayh5_state::csplayh5_map);
m_maincpu->out_parallel_callback().set(FUNC(csplayh5_state::tmp68301_parallel_port_w));
TIMER(config, "scantimer", 0).configure_scanline(timer_device::expired_delegate(FUNC(csplayh5_state::csplayh5_irq), this), "screen", 0, 1);
#if USE_H8
h830002_device &subcpu(H83002(config, "subcpu", DVD_CLOCK/2)); /* unknown divider */
subcpu.set_addrmap(AS_PROGRAM, &csplayh5_state::csplayh5_sub_map);
subcpu.set_addrmap(AS_IO, &csplayh5_state::csplayh5_sub_io_map);
ide_controller_device &ide(IDE_CONTROLLER(config, "ide").options(ata_devices, "hdd", nullptr, true)); // dvd
ide.irq_handler().set(FUNC(csplayh5_state::ide_irq));
#endif
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
/* video hardware */
v9958_device &v9958(V9958(config, "v9958", XTAL(21'477'272))); // typical 9958 clock, not verified
v9958.set_screen_ntsc("screen");
v9958.set_vram_size(0x20000);
v9958.int_cb().set(FUNC(csplayh5_state::csplayh5_vdp0_interrupt));
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
/* sound hardware */
NICHISND(config, m_nichisnd, 0);
}
示例15: M68000
void konmedal68k_state::kzaurus(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(33'868'800)/4); // 33.8688 MHz crystal verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &konmedal68k_state::kzaurus_main);
TIMER(config, "scantimer").configure_scanline(FUNC(konmedal68k_state::scanline), "screen", 0, 1);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(59.62); /* verified on pcb */
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(64*8, 32*8);
screen.set_visarea(40, 400-1, 16, 240-1);
screen.set_screen_update(FUNC(konmedal68k_state::screen_update_konmedal68k));
screen.set_palette("palette");
PALETTE(config, "palette").set_format(palette_device::xBGR_888, 8192).enable_shadows();
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(konmedal68k_state::tile_callback), this);
m_k056832->set_config("gfx1", K056832_BPP_4dj, 1, 0);
m_k056832->set_palette(m_palette);
K055555(config, m_k055555, 0);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
YMZ280B(config, m_ymz, XTAL(33'868'800)/2); // 33.8688 MHz xtal verified on PCB
m_ymz->add_route(0, "lspeaker", 1.0);
m_ymz->add_route(1, "rspeaker", 1.0);
}