Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
JennaHuntsman
XDG Integration
Commits
60e8f990
Commit
60e8f990
authored
4 years ago
by
Callum Prentice
Browse files
Options
Downloads
Patches
Plain Diff
Addresses SL-14582: Add code to only write the file last access time occasionally
parent
850ab463
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llfilesystem/lldiskcache.cpp
+37
-3
37 additions, 3 deletions
indra/llfilesystem/lldiskcache.cpp
with
37 additions
and
3 deletions
indra/llfilesystem/lldiskcache.cpp
+
37
−
3
View file @
60e8f990
...
@@ -205,12 +205,46 @@ const std::string LLDiskCache::metaDataToFilepath(const std::string id,
...
@@ -205,12 +205,46 @@ const std::string LLDiskCache::metaDataToFilepath(const std::string id,
void
LLDiskCache
::
updateFileAccessTime
(
const
std
::
string
file_path
)
void
LLDiskCache
::
updateFileAccessTime
(
const
std
::
string
file_path
)
{
{
const
std
::
time_t
file_time
=
std
::
time
(
nullptr
);
/**
* Threshold in time_t units that is used to decide if the last access time
* time of the file is updated or not. Added as a precaution for the concern
* outlined in SL-14582 about frequent writes on older SSDs reducing their
* lifespan. I think this is the right place for the threshold value - rather
* than it being a pref - do comment on that Jira if you disagree...
*
* Let's start with 1 hour in time_t units and see how that unfolds
*/
const
std
::
time_t
time_threshold
=
1
*
60
*
60
;
// current time
const
std
::
time_t
cur_time
=
std
::
time
(
nullptr
);
#if LL_WINDOWS
#if LL_WINDOWS
boost
::
filesystem
::
last_write_time
(
utf8str_to_utf16str
(
file_path
),
file_time
);
// file last write time
const
std
::
time_t
last_write_time
=
boost
::
filesystem
::
last_write_time
(
utf8str_to_utf16str
(
file_path
));
// delta between cur time and last time the file was written
const
std
::
time_t
delta_time
=
cur_time
-
last_write_time
;
// we only write the new value if the time in time_threshold has elapsed
// before the last one
if
(
delta_time
>
time_threshold
)
{
boost
::
filesystem
::
last_write_time
(
utf8str_to_utf16str
(
file_path
),
cur_time
);
}
#else
#else
boost
::
filesystem
::
last_write_time
(
file_path
,
file_time
);
// file last write time
const
std
::
time_t
last_write_time
=
boost
::
filesystem
::
last_write_time
(
file_path
);
// delta between cur time and last time the file was written
const
std
::
time_t
delta_time
=
cur_time
-
last_write_time
;
// we only write the new value if the time in time_threshold has elapsed
// before the last one
if
(
delta_time
>
time_threshold
)
{
boost
::
filesystem
::
last_write_time
(
file_path
,
cur_time
);
}
#endif
#endif
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment