/*! \brief Perform driver initialization, common to WDM and NT4 driver This function is called from the DriverEntry() of either the WDM or the NT4 driver. \param Driverobject Pointer to the DRIVER_OBJECT structure given to DriverEntry(). \param RegistryPath Pointer to a UNICODE_STRING containing the name of the registry path from which to get the information. \return If the routine succeeds, it returns STATUS_SUCCESS. Otherwise, it returns one of the error status values. */ NTSTATUS DriverCommonInit(IN PDRIVER_OBJECT Driverobject, IN PUNICODE_STRING RegistryPath) { FUNC_ENTER(); // If performance evaluation is active, initialize that PERF_INIT(); // Initialize the settings from the registry cbm_init_registry(RegistryPath, NULL); // set the function pointers to our driver Driverobject->DriverUnload = DriverUnload; Driverobject->MajorFunction[IRP_MJ_CREATE] = cbm_createopenclose; Driverobject->MajorFunction[IRP_MJ_CLOSE] = cbm_createopenclose; Driverobject->MajorFunction[IRP_MJ_CLEANUP] = cbm_cleanup; Driverobject->MajorFunction[IRP_MJ_READ] = cbm_readwrite; Driverobject->MajorFunction[IRP_MJ_WRITE] = cbm_readwrite; Driverobject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = cbm_devicecontrol; FUNC_LEAVE_NTSTATUS_CONST(STATUS_SUCCESS); }
char* initialize ( char* cmdline ) { // Get comnmand line std::string str = cmdline; std::vector<std::string> args; while ( str.length() > 0) { args.push_back ( strSplit ( str, " " ) ); } fileName = ""; for (int n=0; n < args.size(); n++ ) { if ( args[n].compare ( "-f" ) == 0 ) { startFrame = strToI ( args[n+1] ); } if ( args[n].compare ( "-d" ) == 0 ) { // max_draw maxDraw = strToI ( args[n+1] ); } if ( args[n].find_first_of ( "." ) != std::string::npos ) { fileName = args[n]; } } if ( fileName.length()== 0 || args.size()==0 ) { app_printf ( "USAGE: state_view [-f #] [-d #] filename.raw\n\n" ); app_printf ( " -f # Start at frame \n" ); app_printf ( " -d # Maximum number of draw calls to read \n" ); _getch(); exit(-1); } for (int n=0; n < 10; n++ ) bShow[n] = true; // Initialize camera cam.setPos ( 0, 0, 1 ); cam.setToPos ( -window_width*3/8, -window_height*3/8, 1 ); cam.updateMatricies (); // Initialize bin and call names setup_bins (); // Load trace file char fname[256]; strcpy ( fname, fileName.c_str() ); load_trace_raw ( fname ); // required init functions init2D ( "arial_12" ); // specify font file (.bin/tga) setText ( 1.0, -0.5 ); // scale by 0.5, kerning adjust -0.5 pixels setview2D ( window_width, window_height ); // draw visualization layer drawMatrix (); PERF_INIT ( false ); // Enable CPU perf (do not require nv-perfmarker DLL) PERF_SET ( false, 2, false, "" ); // Perf CPU?, CPU level, NV Perfmarkers, Log filename return "NVIDIA State Viewer, by Rama Hoetzlein"; // Return Window title }
void PERF_PUSH ( const char* msg ) { if ( !g_perfInit ) PERF_INIT ( true ); if ( g_perfOn ) { if ( g_perfGPU ) (*g_nvtxPush) (msg); if ( g_perfCPU ) { strncpy ( (char*) g_perfMsg[ g_perfLevel ], msg, 256 ); g_perfStack [ g_perfLevel ] = Time::GetSystemNSec (); if ( g_perfLevel < g_perfPrintLev ) { PERF_PRINTF ( "%*s%s\n", g_perfLevel <<1, "", msg ); if ( g_perfFile != 0x0 ) fprintf ( g_perfFile, "%*s%s\n", g_perfLevel <<1, "", msg ); } } g_perfLevel++; } }
int main(int argc, char** argv) { int i, j, k, t; double t_start, t_end; init_array() ; #ifdef PERFCTR PERF_INIT(); #endif IF_TIME(t_start = rtclock()); #pragma scop for (t=0; t<=T-1; t++) { for (i=1; i<=N-2; i++) { for (j=1; j<=N-2; j++) { a[i][j] = (a[i-1][j-1] + a[i-1][j] + a[i-1][j+1] + a[i][j-1] + a[i][j] + a[i][j+1] + a[i+1][j-1] + a[i+1][j] + a[i+1][j+1])/9.0; } } } #pragma endscop IF_TIME(t_end = rtclock()); IF_TIME(fprintf(stdout, "%0.6lfs\n", t_end - t_start)); #ifdef PERFCTR PERF_EXIT(argv[0]); #endif if (fopen(".test", "r")) { #ifdef MPI if (my_rank == 0) { print_array(); } #else print_array(); #endif } return 0; }
void initialize () { // GUI addGui ( 20, 20, 200, 24, "Frame Time (ms)", GUI_PRINT, GUI_FLOAT, &frameTime, 0, 0 ); addGui ( 20, 50, 200, 24, "Number of Rectangles", GUI_SLIDER, GUI_INT, &numRects, 0, 1000 ); addGui ( 20, 80, 200, 24, "Number of Circles", GUI_SLIDER, GUI_INT, &numCircles, 0, 1000 ); addGui ( 20, 110, 200, 24, "Number of Lines", GUI_SLIDER, GUI_INT, &numLines, 0, 10000 ); addGui ( 20, 140, 200, 24, "Number of Text", GUI_SLIDER, GUI_INT, &numText, 0, 1000 ); glViewport( 0, 0, window_width, window_height ); // required init functions init2D ( "arial_24" ); // specify font file (.bin/tga) setText ( 0.5, -0.5 ); // scale by 0.5, kerning adjust -0.5 pixels setview2D ( window_width, window_height ); setorder2D ( true, -.00001 ); PERF_INIT ( false ); // Enable CPU perf (do not require nv-perfmarker DLL) PERF_SET ( true, 2, false, "" ); // Perf CPU on, Perf print depth, nv-perfmarkers off, no log file }