예제 #1
0
파일: zmwin.c 프로젝트: mingpen/OpenNT
/*  KeyManager - intercept keystrokes and hand them to the active window
 *
 *  We use the top of winList as the current input focus.  All input is handed
 *  to the window procedure EXCEPT for the tab key.  The tab key is responsible
 *  for placing the top window on the bottom of the stack to cycle through the
 *  set of windows.
 *
 */
VOID PASCAL INTERNAL KeyManager (VOID)
{
    LONG    now;
#if defined (HEAPCRAP)
    INT     fHeapChk;
#endif

    /*  do script first in case in contains a password command
     */
    if ( pInitScript )
        DoScript ( hCommand, pInitScript, 0 );

    if (fMailAllowed) {
        GetAliases ( fNotifyTools & F_LOADALIAS );
        fNotifyTools &= ~(FLAG)F_LOADALIAS;
        NotifyTools ( );
        }
    if ( fComposeOnBoot )
        ( *( winList->wndProc ) ) ( winList, KEY, 0 );

    SendMessage ( hCommand, DISPPROMPT, TRUE );

    while ( ( winList != NULL ) && ( !fQuit ) ) {
        time ( &now );
	CheckTimeDisplay ( now );

        if ( pInitHdrCmd ) {
            DoHeaders ( hCommand, pInitHdrCmd, TRUE );
            SendMessage ( hCommand, DISPPROMPT, 0 );
            ZMfree ( pInitHdrCmd );
            pInitHdrCmd = NULL;
        }

        /*  if system has not received a char for 10 sec then checkmail
         */
        if (fMailAllowed)
            CheckMail ( now );

        /*  time out password after (default) 6 hours in case user has
         *  left WZMAIL running and gone home
         */
        if ( now > lTmPassword + lPasswordAge )
            ResetPassword ( );

        if ( now > lTmConnect + cSecConnect )
            ZMDisconnect ( );

        /*  On multitasking systems, it is rude to go into polling loops.
         *
         *  For OS/2, we have a separate thread dedicated to reading from the
         *  console.  We clear a semaphore to let him read and then wait on
         *  a response semaphore with the specified timeout.  This avoids
         *  polling.
         *
         *  For real mode DOS, we presume that INT 16 (poll) will cause an
         *  explicit yield to other runnable threads.
         */
        if (kbwait (60 * 1000)) {

            fMailUnSeen = FALSE;

            do {
                (*winList->wndProc) ( winList, KEY, ReadKey() );

            } while (!fQuit && kbwait (10000));
        }

#if defined (HEAPCRAP)
        if ( ( fHeapChk = heapchk ( ) ) != HEAPOK ) {
            fprintf ( stderr, "%s\n",
                ( fHeapChk == HEAPBADBEGIN ? "Can't find heap" :
                    "Damaged heap" ) );
            assert ( fHeapChk == HEAPOK );
            }
#endif

    }
    return;
}
예제 #2
0
int main( int argc, char *argv[]){
  #ifdef ZOOM_PROFILE
  std::cout << "Connect" <<  ZMConnect() << std::endl;
  #endif
 
  po::variables_map vm;
  process_args( argc, argv, vm);
  size_t num_parts = atoi( vm[ "num-parts"].as< std::string>().c_str());

  //setup some variables
  std::string full_complex_name = vm[ "input-file"].as< std::string>();
  std::string complex_name( full_complex_name);
  std::string binary_name( argv[ 0]);

  size_t found = complex_name.rfind( '/');
  if ( found != std::string::npos){
        complex_name.replace( 0, found+1, "");
  }
  tbb::task_scheduler_init init;
  
  Complex complex;
  Nerve nerve;
  tbb::concurrent_vector< Complex_iterator> nearly_pure;
  Stats stats;

  // Read the cell_set in
  //read_complex( full_complex_name, complex);
  stats.timer.start();
  Complex_filtration complex_filtration( complex);
  stats.timer.stop();
  double orig_filtration_time = stats.timer.elapsed();
  std::cout << "filtered complex " << orig_filtration_time << std::endl;
  stats.timer.start();
  ctl::parallel::init_cover_complex( nerve, num_parts);
  ctl::parallel::graph_partition_open_cover( complex_filtration, nerve, nearly_pure);
  stats.timer.stop();
  double cover_time = stats.timer.elapsed();
  std::cout << "built cover." << std::endl;
  #ifdef ZOOM_PROFILE
  std::cout << "Profiling Begin";
  ZMError start_error = ZMStartSession();
  std::cout << start_error << std::endl;
  #endif 
 
  ctl::parallel::compute_homology( complex, nerve, num_parts, stats);
  #ifdef ZOOM_PROFILE
  ZMError end_error = ZMStopSession();
  std::cout << "Profiling End" << end_error << std::endl;
  #endif
  #ifdef ZOOM_PROFILE
   std::cout << "Disconnect" <<  ZMDisconnect() << std::endl;
  #endif
  double total_time = cover_time + stats.filtration_time + stats.get_iterators +
         	     stats.parallel_persistence + stats.initialize_cascade_boundary;
                  
  std::cout << std::setprecision( 2) << std::fixed;
                                                                                
  std::cout << "build cover: " << cover_time 
            << " (" << (cover_time/total_time)*100 << "%)" << std::endl;
                                                                                
  std::cout << "re-filter complex: " << stats.filtration_time 
            << " (" << (stats.filtration_time/total_time)*100 << "%)" 
            << std::endl;
  std::cout << "compute parallel ranges: " << stats.get_iterators
            << " (" << (stats.get_iterators/total_time)*100 << "%)" 
	    << std::endl;
  std::cout << "initialize_cascade_boundary: " 
            << stats.initialize_cascade_boundary << " (" 
            << (stats.initialize_cascade_boundary/total_time)*100 << "%)" << std::endl;
  std::cout << "parallel_homology: " 
            << stats.parallel_persistence << " (" 
            << (stats.parallel_persistence/total_time)*100 << "%)" << std::endl;
  std::cout << "total time: " << total_time << " (100%)" << std::endl;

#ifdef TESTS_ON
  ctl::run_tests( complex, blowup_complex, nerve);
#endif
  init.terminate();
  return 0;
}