コード例 #1
0
ファイル: ResourceLoader.cpp プロジェクト: Wiggan/SuperMotorn
void
ResourceLoader::lookForChanges() {
    for ( auto it = mResources.begin(); it != mResources.end(); ++it ) {
        AbstractResource* res = it->second;
        TimeStamp timestamp = getFileTimeStamp(res->getFileName());
        if ( timestamp != res->getTimeStamp() ) {
            std::wcout << L"Updating " << res->getFileName() << std::endl;
            res->load();
            res->setTimeStamp(timestamp);
        }
    }
}
コード例 #2
0
ファイル: FSseeker.c プロジェクト: jimiszm/peos
int getDate( const char *filename, const struct stat *statptr, int flag )
{
	void getFileTimeStamp( char * , char * ) ;

	char theFileName[BUFFER_SIZE] = { '\0' } ;
	char fileDate[20] = { '\0' } ;
	
	time_t fileDateTime ;
		
	switch ( flag )
	{
		case FTW_F : 	getFileTimeStamp( fileDate, ctime(  &statptr -> st_mtime  ) ) ;
				fileDateTime = parsedate( fileDate, NULL ) ;
				strcat( theFileName, "file://" ) ;
				
				if( strcmp( operatorType, "EQ" ) == 0 )
    				{	    											
					if( difftime( fileDateTime, fileQueryTime ) == 0 )
					{
						strcat( theFileName, filename ) ;
						dateResults = addResultItem( dateResults, theFileName ) ;
					}
				}
				else if( strcmp( operatorType, "LT" ) == 0 )
				{
					if( difftime( fileDateTime, fileQueryTime ) < 0 )
					{
						strcat( theFileName, filename ) ;
						dateResults = addResultItem( dateResults, theFileName ) ;
					}
				}
				else if( strcmp( operatorType, "LE" ) == 0 )
				{
					if( ( difftime( fileDateTime, fileQueryTime ) == 0 ) ||
					    ( difftime( fileDateTime, fileQueryTime ) < 0 ) )
					{
						strcat( theFileName, filename ) ;
						dateResults = addResultItem( dateResults, theFileName ) ;
					}
				}
				else if( strcmp( operatorType, "GT" ) == 0 )
				{
					if( difftime( fileDateTime, fileQueryTime ) > 0 )
					{
						strcat( theFileName, filename ) ;
						dateResults = addResultItem( dateResults, theFileName ) ;
					}
				}
				else if( strcmp( operatorType, "GE" ) == 0 )
				{
					if( ( difftime( fileDateTime, fileQueryTime ) == 0 ) ||
					    ( difftime( fileDateTime, fileQueryTime ) > 0 ) )
					{
						strcat( theFileName, filename ) ;
						dateResults = addResultItem( dateResults, theFileName ) ;
					}
				}
				break ;
	}
	return 0 ;
}
コード例 #3
0
bool CudaCompiler::runPreprocessor(std::string& cubinFile, std::string& finalOpts)
{
  // Preprocess.
  finalOpts = "";
  
  if (s_staticOptions.length()) {
    finalOpts += s_staticOptions + " ";
  }
  finalOpts += m_options;

  std::string logFile = m_cachePath + "/preprocess.log";
  
  std::string cmd = s_nvccCommand + " -E -o \"" + m_cachePath + "/preprocessed.cu\" " +
                    "-include \"" + m_cachePath + "/defines.inl\" " + 
                    finalOpts + " \"" + m_sourceFile + 
                    "\" 2>>\"" + logFile + "\"";

  initLogFile( logFile, cmd);
  
  if (0 != system(cmd.c_str()))
  {
    setLoggedError("CudaCompiler: Preprocessing failed!", logFile);
    return false;
  }

  // Specify binary format.
  if (s_staticBinaryFormat.length()) {
    finalOpts += s_staticBinaryFormat;
  } else {
    finalOpts += "-cubin";
  }
  finalOpts += " ";

  
  U32 hashA = FW_HASH_MAGIC;
  U32 hashB = FW_HASH_MAGIC;
  U32 hashC = FW_HASH_MAGIC;
  
  // Override SM architecture.
  S32 smArch = m_overriddenSMArch;
  if (!smArch) {
    smArch = CudaModule::getComputeCapability();
  }

  finalOpts = removeOption(finalOpts, "-arch", true);
  finalOpts = removeOption(finalOpts, "--gpu-architecture", true);
  
  char smArch_str[32];
  sprintf(smArch_str, "-arch sm_%d ", smArch);
  finalOpts += std::string(smArch_str);

  // Override pointer width.
  // CUDA 3.2 => requires -m32 for x86 build and -m64 for x64 build.
  if (CudaModule::getDriverVersion() >= 32)
  {
    finalOpts = removeOption(finalOpts, "-m32", false);
    finalOpts = removeOption(finalOpts, "-m64", false);
    finalOpts = removeOption(finalOpts, "--machine", true);

#if FW_64
    finalOpts += "-m64 ";
#else
    finalOpts += "-m32 ";
#endif
  }
    
  // Hash final compiler options and version.
  hashA += hash<std::string>(finalOpts);
  hashB += s_nvccVersionHash;
  FW_JENKINS_MIX(hashA, hashB, hashC);
  
  // File's timestamp hash to recompile when modified.
  U64 hashD = getFileTimeStamp( m_sourceFile );
  
  std::string fileName = hashToString(hashB) + 
                         hashToString(hashC) +
                         hashToString(hashD);
  
  cubinFile = m_cachePath + "/" + fileName + ".cubin";
  
  return true;
}