mirror of
https://github.com/verilator/verilator.git
synced 2025-05-03 05:56:53 +00:00
Remove slow sync() call for NFS flushing.
This commit is contained in:
parent
936855c81c
commit
238fc24684
@ -162,13 +162,11 @@ inline void V3FileDependImp::writeTimes(const string& filename, const string& cm
|
||||
*ofp<<"# DESCR"<<"IPTION: Verilator output: Timestamp data for --skip-identical. Delete at will."<<endl;
|
||||
*ofp<<"C \""<<cmdline<<"\""<<endl;
|
||||
|
||||
#ifndef _WIN32
|
||||
sync(); // Push files so sizes look correct
|
||||
#endif
|
||||
for (set<DependFile>::iterator iter=m_filenameList.begin();
|
||||
iter!=m_filenameList.end(); ++iter) {
|
||||
// Read stats of files we create after we're done making them (execpt for this file, of course)
|
||||
DependFile* dfp = (DependFile*)&(*iter);
|
||||
V3Options::fileNfsFlush(dfp->filename());
|
||||
dfp->loadStats();
|
||||
off_t showSize = iter->size();
|
||||
if (dfp->filename() == filename) showSize=0; // We're writing it, so need to ignore it
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <cctype>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <map>
|
||||
@ -277,6 +278,17 @@ bool V3Options::fileStatNormal(const string& filename) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void V3Options::fileNfsFlush(const string& filename) {
|
||||
// NFS caches stat() calls so to get up-to-date information must
|
||||
// do a open or opendir on the filename.
|
||||
// Faster to just try both rather than check if a file is a dir.
|
||||
if (DIR* dirp = opendir(filename.c_str())) {
|
||||
closedir(dirp);
|
||||
} else if (int fd = ::open(filename.c_str(), O_RDONLY)) {
|
||||
if (fd>0) ::close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
string V3Options::fileExists (const string& filename) {
|
||||
// Surprisingly, for VCS and other simulators, this process
|
||||
// is quite slow; presumably because of re-reading each directory
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
class V3OptionsImp;
|
||||
class FileLine;
|
||||
struct stat;
|
||||
|
||||
typedef vector<string> V3StringList;
|
||||
typedef set<string> V3StringSet;
|
||||
@ -321,6 +322,7 @@ class V3Options {
|
||||
V3LangCode fileLanguage(const string &filename);
|
||||
static bool fileStatDir (const string& filename);
|
||||
static bool fileStatNormal (const string& filename);
|
||||
static void fileNfsFlush(const string& filename);
|
||||
|
||||
// METHODS (other OS)
|
||||
static void throwSigsegv();
|
||||
|
Loading…
Reference in New Issue
Block a user