//================ Copyright (c) Valve Corporation. All Rights Reserved. =========================== // // // //================================================================================================== //-------------------------------------------------------------------------------------------------- // Headers //-------------------------------------------------------------------------------------------------- #include "Profile.h" #include //-------------------------------------------------------------------------------------------------- // Functions //-------------------------------------------------------------------------------------------------- /* * Insert a marker that is displayed in Tuner */ void insert_bookmark( uint32_t bookmark ) { __asm__ volatile ("wrch $69, %0" :: "r" (bookmark)); // Must wait for 16 cycles __asm__ volatile ("nop;nop;nop;nop;nop;nop;nop;nop"); __asm__ volatile ("nop;nop;nop;nop;nop;nop;nop;nop"); } void bookmark_delay( int NumBookmarks ) { // 400 cycles per bookmark when emitting bookmarks on both SPUs for ( int i=0; i> 2 ); // LSA is shifted by 2 as per the SPURS spec. insert_bookmark( 0xffab ); // start marker 2 bookmark_delay( NUM_BOOKMARKS_IN_EVENT ); } /* * Inserting 6 SPU bookmarks, which will * be identified by Tuner as a stop event */ void raw_spu_prof_stop( uint16_t lsa ) { typedef union { uint16_t u16[4]; uint64_t u64; } GUID_u; GUID_u guid; qword insn = si_roti(*(qword*)(0x80 + lsa), 7); qword pattern = (qword)(vec_uchar16){0,1,4,5,8,9,12,13,0,1,4,5,8,9,12,13}; guid.u64 = si_to_ullong(si_shufb(insn, insn, pattern)); insert_bookmark( 0xffac ); // start marker 1 insert_bookmark( guid.u16[0] ); // guid insert_bookmark( guid.u16[1] ); // guid insert_bookmark( guid.u16[2] ); // guid insert_bookmark( guid.u16[3] ); // guid insert_bookmark( 0xffad ); // start marker 2 bookmark_delay( NUM_BOOKMARKS_IN_EVENT ); }