mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 07:58:35 +00:00
API: nvim__stats()
Use it to verify fsync() behavior.
This commit is contained in:
@@ -1473,6 +1473,17 @@ Float nvim__id_float(Float flt)
|
||||
return flt;
|
||||
}
|
||||
|
||||
/// Gets internal stats.
|
||||
///
|
||||
/// @return Map of various internal stats.
|
||||
Dictionary nvim__stats(void)
|
||||
{
|
||||
Dictionary rv = ARRAY_DICT_INIT;
|
||||
PUT(rv, "fsync", INTEGER_OBJ(g_stats.fsync));
|
||||
PUT(rv, "redraw", INTEGER_OBJ(g_stats.redraw));
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Gets a list of dictionaries representing attached UIs.
|
||||
///
|
||||
/// @return Array of UI dictionaries
|
||||
|
@@ -80,6 +80,11 @@ typedef enum {
|
||||
kTrue = 1,
|
||||
} TriState;
|
||||
|
||||
EXTERN struct nvim_stats_s {
|
||||
int64_t fsync;
|
||||
int64_t redraw;
|
||||
} g_stats INIT(= { 0, 0 });
|
||||
|
||||
/* Values for "starting" */
|
||||
#define NO_SCREEN 2 /* no screen updating yet */
|
||||
#define NO_BUFFERS 1 /* not all buffers loaded yet */
|
||||
|
@@ -629,6 +629,7 @@ int os_fsync(int fd)
|
||||
{
|
||||
int r;
|
||||
RUN_UV_FS_FUNC(r, uv_fs_fsync, fd, NULL);
|
||||
g_stats.fsync++;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user