noun: add -C to control memo cache size

This commit is contained in:
Philip Monk 2020-06-24 17:08:50 -07:00
parent 71fa03457c
commit 361e41e78d
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
5 changed files with 21 additions and 7 deletions

View File

@ -93,10 +93,11 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.tex = c3n;
u3_Host.ops_u.tra = c3n;
u3_Host.ops_u.veb = c3n;
u3_Host.ops_u.hap_w = 50000;
u3_Host.ops_u.kno_w = DefaultKernel;
while ( -1 != (ch_i=getopt(argc, argv,
"G:J:B:K:A:H:I:w:u:e:F:k:p:LljacdgqstvxPDRS")) )
"G:J:B:K:A:H:I:C:w:u:e:F:k:p:LljacdgqstvxPDRS")) )
{
switch ( ch_i ) {
case 'J': {
@ -123,6 +124,12 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.jin_c = strdup(optarg);
break;
}
case 'C': {
if ( c3n == _main_readw(optarg, 1000000000, &u3_Host.ops_u.hap_w) ) {
return c3n;
}
break;
}
case 'e': {
u3_Host.ops_u.eth_c = strdup(optarg);
break;
@ -367,9 +374,9 @@ u3_ve_usage(c3_i argc, c3_c** argv)
"where ship_name is a @p phonetic representation of an urbit address\n",
"without the leading '~', and options is some subset of the following:\n",
"\n",
// XX find a way to re-enable
// "-A dir Use dir for initial galaxy sync\n",
"-A dir Use dir for initial clay sync\n",
"-B pill Bootstrap from this pill\n",
"-C limit Set memo cache max size; 0 means uncapped\n",
"-c pier Create a new urbit in pier/\n",
"-D Recompute from events\n",
"-d Daemon mode; implies -t\n",

View File

@ -559,6 +559,7 @@
c3_o gab; // -g, test garbage collection
c3_c* dns_c; // -H, ames bootstrap domain
c3_c* jin_c; // -I, inject raw event
c3_w hap_w; // -C, cap memo cache
c3_c* lit_c; // -J, ivory (fastboot) kernel
c3_o tra; // -j, json trace
c3_w kno_w; // -K, kernel version

View File

@ -10,6 +10,7 @@
#include <openssl/crypto.h>
#include "all.h"
#include "vere/vere.h"
// XX stack-overflow recovery should be gated by -a
//
@ -496,7 +497,7 @@ _pave_south(c3_w* mem_w, c3_w siz_w, c3_w len_w)
static void
_pave_parts(void)
{
u3R->cax.har_p = u3h_new_cache(50000);
u3R->cax.har_p = u3h_new_cache(u3_Host.ops_u.hap_w);
u3R->jed.war_p = u3h_new();
u3R->jed.cod_p = u3h_new();
u3R->jed.han_p = u3h_new();

View File

@ -1039,11 +1039,12 @@ _pier_work_create(u3_pier* pir_u)
/* spawn new process and connect to it
*/
{
c3_c* arg_c[5];
c3_c* arg_c[6];
c3_c* bin_c = u3_Host.wrk_c;
c3_c* pax_c = pir_u->pax_c;
c3_c key_c[256];
c3_c wag_c[11];
c3_c hap_c[11];
c3_i err_i;
sprintf(key_c, "%" PRIx64 ":%" PRIx64 ":%" PRIx64 ":%" PRIx64 "",
@ -1053,12 +1054,14 @@ _pier_work_create(u3_pier* pir_u)
pir_u->key_d[3]);
sprintf(wag_c, "%u", pir_u->wag_w);
sprintf(hap_c, "%u", u3_Host.ops_u.hap_w);
arg_c[0] = bin_c; // executable
arg_c[1] = pax_c; // path to checkpoint directory
arg_c[2] = key_c; // disk key
arg_c[3] = wag_c; // runtime config
arg_c[4] = 0;
arg_c[4] = hap_c; // hash table size
arg_c[5] = 0;
uv_pipe_init(u3L, &god_u->inn_u.pyp_u, 0);
uv_pipe_init(u3L, &god_u->out_u.pyp_u, 0);

View File

@ -1015,8 +1015,9 @@ main(c3_i argc, c3_c* argv[])
c3_c* dir_c = argv[1];
c3_c* key_c = argv[2];
c3_c* wag_c = argv[3];
c3_c* hap_c = argv[4];
c3_assert(4 == argc);
c3_assert(5 == argc);
memset(&u3V, 0, sizeof(u3V));
memset(&u3_Host.tra_u, 0, sizeof(u3_Host.tra_u));
@ -1035,6 +1036,7 @@ main(c3_i argc, c3_c* argv[])
*/
{
sscanf(wag_c, "%" SCNu32, &u3C.wag_w);
sscanf(hap_c, "%" SCNu32, &u3_Host.ops_u.hap_w);
}
/* load pier directory