lighter weight sync testing
parent
bf9f1167a0
commit
238b86e37f
54
4ed.cpp
54
4ed.cpp
|
@ -1653,6 +1653,7 @@ update_cli_handle_with_file(System_Functions *system, Models *models,
|
|||
return(result);
|
||||
}
|
||||
|
||||
|
||||
App_Step_Sig(app_step){
|
||||
Application_Step_Result app_result = *result;
|
||||
app_result.animating = 0;
|
||||
|
@ -1673,17 +1674,14 @@ App_Step_Sig(app_step){
|
|||
}
|
||||
|
||||
// NOTE(allen): check files are up to date
|
||||
{
|
||||
File_Node *node, *used_nodes;
|
||||
Editing_File *file;
|
||||
u64 time_stamp;
|
||||
|
||||
used_nodes = &models->working_set.used_sentinel;
|
||||
for (dll_items(node, used_nodes)){
|
||||
file = (Editing_File*)node;
|
||||
if (!input->first_step){
|
||||
Panel *panel = 0, *used_panels = &models->layout.used_sentinel;
|
||||
for (dll_items(panel, used_panels)){
|
||||
View *view = panel->view;
|
||||
Editing_File *file = view->file_data.file;
|
||||
|
||||
terminate_with_null(&file->name.source_path);
|
||||
time_stamp = system->file_time_stamp(file->name.source_path.str);
|
||||
u64 time_stamp = system->file_time_stamp(file->name.source_path.str);
|
||||
|
||||
if (time_stamp > 0){
|
||||
if (file->state.last_sync < time_stamp){
|
||||
|
@ -1691,6 +1689,36 @@ App_Step_Sig(app_step){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
File_Node *node = models->working_set.sync_check_iter;
|
||||
File_Node *used_nodes = &models->working_set.used_sentinel;
|
||||
|
||||
if (node == used_nodes){
|
||||
node = node->next;
|
||||
}
|
||||
Assert(!((Editing_File*)node)->is_dummy);
|
||||
|
||||
for (i32 i = 0; i < 4; ++i){
|
||||
if (node == used_nodes){
|
||||
break;
|
||||
}
|
||||
|
||||
Editing_File *file = (Editing_File*)node;
|
||||
|
||||
terminate_with_null(&file->name.source_path);
|
||||
u64 time_stamp = system->file_time_stamp(file->name.source_path.str);
|
||||
|
||||
if (time_stamp > 0){
|
||||
if (file->state.last_sync < time_stamp){
|
||||
file_mark_behind_os(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
models->working_set.sync_check_iter = node;
|
||||
}
|
||||
else{
|
||||
models->working_set.sync_check_iter = &models->working_set.used_sentinel;
|
||||
}
|
||||
|
||||
// NOTE(allen): reorganizing panels on screen
|
||||
|
@ -1700,8 +1728,8 @@ App_Step_Sig(app_step){
|
|||
i32 current_width = target->width;
|
||||
i32 current_height = target->height;
|
||||
|
||||
Panel *panel, *used_panels;
|
||||
View *view;
|
||||
Panel *panel = 0, *used_panels = &models->layout.used_sentinel;
|
||||
View *view = 0;
|
||||
|
||||
models->layout.full_width = current_width;
|
||||
models->layout.full_height = current_height;
|
||||
|
@ -1709,7 +1737,6 @@ App_Step_Sig(app_step){
|
|||
if (prev_width != current_width || prev_height != current_height){
|
||||
layout_refit(&models->layout, prev_width, prev_height);
|
||||
|
||||
used_panels = &models->layout.used_sentinel;
|
||||
for (dll_items(panel, used_panels)){
|
||||
view = panel->view;
|
||||
Assert(view);
|
||||
|
@ -2228,6 +2255,7 @@ App_Step_Sig(app_step){
|
|||
view->changed_context_in_step = 0;
|
||||
|
||||
View_Step_Result result = step_file_view(system, view, active_view, summary);
|
||||
|
||||
if (result.animating){
|
||||
app_result.animating = 1;
|
||||
}
|
||||
|
@ -2705,8 +2733,6 @@ App_Step_Sig(app_step){
|
|||
|
||||
*result = app_result;
|
||||
|
||||
Assert(general_memory_check(&models->mem.general));
|
||||
|
||||
// end-of-app_step
|
||||
}
|
||||
|
||||
|
|
|
@ -215,6 +215,8 @@ struct Working_Set{
|
|||
i32 clipboard_current, clipboard_rolling;
|
||||
|
||||
u64 unique_file_counter;
|
||||
|
||||
File_Node *sync_check_iter;
|
||||
};
|
||||
|
||||
struct File_Entry{
|
||||
|
@ -457,6 +459,10 @@ working_set_alloc_always(Working_Set *working_set, General_Memory *general){
|
|||
|
||||
inline void
|
||||
working_set_free_file(Working_Set *working_set, Editing_File *file){
|
||||
if (working_set->sync_check_iter == &file->node){
|
||||
working_set->sync_check_iter = working_set->sync_check_iter->next;
|
||||
}
|
||||
|
||||
file->is_dummy = 1;
|
||||
dll_remove(&file->node);
|
||||
dll_insert(&working_set->free_sentinel, &file->node);
|
||||
|
|
|
@ -18,14 +18,15 @@ Allen Webster
|
|||
|
||||
#include <Windows.h>
|
||||
|
||||
// NOTE(allen): This timing restriction is based on 4GHz and 60fps
|
||||
// 4G / 60 ~= 70M Reserving most of that time for rendering and hopefully idling
|
||||
// I set the goal of 10M for all tests.
|
||||
#define TEST_TIME_B(m) DWORD64 time_start = __rdtsc(), time_max = m
|
||||
#define TEST_TIME_E() DWORD64 time_total = __rdtsc() - time_start; if (time_total > time_max) {assert(!"failed timing");}
|
||||
#define TEST_TIME_M(m) m = (float)(__rdtsc() - time_start) / time_max
|
||||
|
||||
CUSTOM_COMMAND_SIG(load_lots_of_files){
|
||||
|
||||
// NOTE(allen): This timing restriction is based on 4GHz and 60fps
|
||||
// 4G / 60 ~= 70M Reserving most of that time for rendering and hopefully idling
|
||||
// I set the goal of 10M for all tests.
|
||||
TEST_TIME_B(10000000);
|
||||
|
||||
File_List list = app->get_file_list(app, literal(LOTS_OF_FILES));
|
||||
|
@ -34,12 +35,13 @@ CUSTOM_COMMAND_SIG(load_lots_of_files){
|
|||
for (int i = 0; i < list.count; ++i, ++info){
|
||||
if (!info->folder){
|
||||
app->create_buffer(app, info->filename, info->filename_len,
|
||||
BufferCreate_Background | BufferCreate_AlwaysNew);
|
||||
BufferCreate_Background);
|
||||
}
|
||||
}
|
||||
|
||||
app->free_file_list(app, list);
|
||||
|
||||
// TODO(allen): Pass this time test!
|
||||
TEST_TIME_E();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue