Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/0bc32aa654271fd592d36fabf272e3fa0ca0a450
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/0bc32aa654271fd592d36fabf272e3fa0ca0a450
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/0bc32aa654271fd592d36fabf272e3fa0ca0a450

The branch, master has been updated
       via  0bc32aa654271fd592d36fabf272e3fa0ca0a450 (commit)
      from  4fb38f574a303d53fb3e4560e76163e4e97687b3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=0bc32aa654271fd592d36fabf272e3fa0ca0a450
commit 0bc32aa654271fd592d36fabf272e3fa0ca0a450
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Add more clib2 stats
    JSON formatted data can now be saved with ARexx "SLABSTATS stats.json"

diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 18dae24..b970228 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -118,7 +118,7 @@ STATIC struct ARexxCmd Commands[] =
        {"ACTIVE",      RX_ACTIVE,      rx_active,      "T=TAB/S",              
0,      NULL,   0,      0,      NULL },
        {"CLOSE",       RX_CLOSE,       rx_close,       
"W=WINDOW/K/N,T=TAB/K/N",               0,      NULL,   0,      0,      NULL },
        {"HOTLIST",     RX_HOTLIST,     rx_hotlist,     "A=ACTION/A",           
0,      NULL,   0,      0,      NULL },
-       {"SLABSTATS",   RX_SLABSTATS,   rx_slabstats,   NULL,           0,      
NULL,   0,      0,      NULL },
+       {"SLABSTATS",   RX_SLABSTATS,   rx_slabstats,   "FILE",                 
0,      NULL,   0,      0,      NULL },
        { NULL,                 0,                              NULL,           
NULL,           0,      NULL,   0,      0,      NULL }
 };
 
@@ -674,7 +674,14 @@ RXHOOKF(rx_hotlist)
 RXHOOKF(rx_slabstats)
 {
 #ifndef __amigaos4__
-       ami_memory_slab_dump();
+       BPTR fh = 0;
+
+       if(cmd->ac_ArgList[0] != NULL) {
+               fh = Open((char *)cmd->ac_ArgList[0], MODE_NEWFILE);
+       }
+       ami_memory_slab_dump(fh);
+
+       if(fh != 0) Close(fh);
 #endif
 }
 
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index 8f901a1..d371d25 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -17,6 +17,7 @@
  */
 
 #ifndef __amigaos4__
+#include <proto/dos.h>
 #include <proto/exec.h>
 #include <exec/interrupts.h>
 #include <stdlib.h>
@@ -46,7 +47,7 @@ void *ami_memory_clear_alloc(size_t size, UBYTE value)
 }
 
 /* clib2 slab allocator stats */
-static int ami_memory_slab_callback(const struct __slab_usage_information * 
sui)
+static int ami_memory_slab_usage_cb(const struct __slab_usage_information * 
sui)
 {
        if(sui->sui_slab_index <= 1) {
                LOG("clib2 slab usage:");
@@ -70,11 +71,43 @@ static int ami_memory_slab_callback(const struct 
__slab_usage_information * sui)
        return 0;
 }
 
-void ami_memory_slab_dump(void)
+static int ami_memory_slab_alloc_cb(const struct __slab_allocation_information 
*sai)
 {
-       __get_slab_usage(ami_memory_slab_callback);
+       if(sai->sai_allocation_index <= 1) {
+               LOG("clib2 allocation usage:");
+               LOG("  Number of allocations which are not managed by slabs: 
%ld",
+                       sai->sai_num_single_allocations);
+               LOG("  Total number of bytes allocated for memory not managed 
by slabs: %ld",
+                       sai->sai_total_single_allocation_size);
+       }
+       LOG("Alloc %d", sai->sai_allocation_index);
+       LOG("  Size of this allocation, as requested: %ld", 
sai->sai_allocation_size);
+       LOG("  Total size of this allocation, including management data: %ld",
+               sai->sai_total_allocation_size);
+
+       return 0;
+}
+
+static int ami_memory_slab_stats_cb(void *user_data, const char *line, size_t 
line_length)
+{
+       BPTR fh = (BPTR)user_data;
+       long err = FPuts(fh, line);
+
+       if(err != 0) {
+               return -1;
+       } else {
+               return 0;
+       }
+}
+
+void ami_memory_slab_dump(BPTR fh)
+{
+       __get_slab_usage(ami_memory_slab_usage_cb);
+       __get_slab_allocations(ami_memory_slab_alloc_cb);
+       __get_slab_stats(fh, ami_memory_slab_stats_cb);
 }
 
+/* Low memory handler */
 static void ami_memory_low_mem_handler(void *p)
 {
        if(low_mem_status == PURGE_STEP1) {
@@ -115,7 +148,7 @@ struct Interrupt *ami_memory_init(void)
        struct Interrupt *memhandler = malloc(sizeof(struct Interrupt));
        if(memhandler == NULL) return NULL; // we're screwed
 
-       memhandler->is_Node.ln_Pri = -100; // low down as will be slow
+       memhandler->is_Node.ln_Pri = -127; // low down as will be slow
        memhandler->is_Node.ln_Name = "NetSurf low memory handler";
        memhandler->is_Data = NULL;
        memhandler->is_Code = (APTR)&ami_memory_handler;
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index a87a3ea..7abf0a3 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -59,7 +59,7 @@ void *ami_memory_clear_alloc(size_t size, UBYTE value);
 
 /* clib2 slab allocator */
 #ifndef __amigaos4__
-void ami_memory_slab_dump(void);
+void ami_memory_slab_dump(BPTR fh);
 struct Interrupt *ami_memory_init(void);
 void ami_memory_fini(struct Interrupt *memhandler);
 #endif


-----------------------------------------------------------------------

Summary of changes:
 frontends/amiga/arexx.c  |   11 +++++++++--
 frontends/amiga/memory.c |   41 +++++++++++++++++++++++++++++++++++++----
 frontends/amiga/memory.h |    2 +-
 3 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 18dae24..b970228 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -118,7 +118,7 @@ STATIC struct ARexxCmd Commands[] =
        {"ACTIVE",      RX_ACTIVE,      rx_active,      "T=TAB/S",              
0,      NULL,   0,      0,      NULL },
        {"CLOSE",       RX_CLOSE,       rx_close,       
"W=WINDOW/K/N,T=TAB/K/N",               0,      NULL,   0,      0,      NULL },
        {"HOTLIST",     RX_HOTLIST,     rx_hotlist,     "A=ACTION/A",           
0,      NULL,   0,      0,      NULL },
-       {"SLABSTATS",   RX_SLABSTATS,   rx_slabstats,   NULL,           0,      
NULL,   0,      0,      NULL },
+       {"SLABSTATS",   RX_SLABSTATS,   rx_slabstats,   "FILE",                 
0,      NULL,   0,      0,      NULL },
        { NULL,                 0,                              NULL,           
NULL,           0,      NULL,   0,      0,      NULL }
 };
 
@@ -674,7 +674,14 @@ RXHOOKF(rx_hotlist)
 RXHOOKF(rx_slabstats)
 {
 #ifndef __amigaos4__
-       ami_memory_slab_dump();
+       BPTR fh = 0;
+
+       if(cmd->ac_ArgList[0] != NULL) {
+               fh = Open((char *)cmd->ac_ArgList[0], MODE_NEWFILE);
+       }
+       ami_memory_slab_dump(fh);
+
+       if(fh != 0) Close(fh);
 #endif
 }
 
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index 8f901a1..d371d25 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -17,6 +17,7 @@
  */
 
 #ifndef __amigaos4__
+#include <proto/dos.h>
 #include <proto/exec.h>
 #include <exec/interrupts.h>
 #include <stdlib.h>
@@ -46,7 +47,7 @@ void *ami_memory_clear_alloc(size_t size, UBYTE value)
 }
 
 /* clib2 slab allocator stats */
-static int ami_memory_slab_callback(const struct __slab_usage_information * 
sui)
+static int ami_memory_slab_usage_cb(const struct __slab_usage_information * 
sui)
 {
        if(sui->sui_slab_index <= 1) {
                LOG("clib2 slab usage:");
@@ -70,11 +71,43 @@ static int ami_memory_slab_callback(const struct 
__slab_usage_information * sui)
        return 0;
 }
 
-void ami_memory_slab_dump(void)
+static int ami_memory_slab_alloc_cb(const struct __slab_allocation_information 
*sai)
 {
-       __get_slab_usage(ami_memory_slab_callback);
+       if(sai->sai_allocation_index <= 1) {
+               LOG("clib2 allocation usage:");
+               LOG("  Number of allocations which are not managed by slabs: 
%ld",
+                       sai->sai_num_single_allocations);
+               LOG("  Total number of bytes allocated for memory not managed 
by slabs: %ld",
+                       sai->sai_total_single_allocation_size);
+       }
+       LOG("Alloc %d", sai->sai_allocation_index);
+       LOG("  Size of this allocation, as requested: %ld", 
sai->sai_allocation_size);
+       LOG("  Total size of this allocation, including management data: %ld",
+               sai->sai_total_allocation_size);
+
+       return 0;
+}
+
+static int ami_memory_slab_stats_cb(void *user_data, const char *line, size_t 
line_length)
+{
+       BPTR fh = (BPTR)user_data;
+       long err = FPuts(fh, line);
+
+       if(err != 0) {
+               return -1;
+       } else {
+               return 0;
+       }
+}
+
+void ami_memory_slab_dump(BPTR fh)
+{
+       __get_slab_usage(ami_memory_slab_usage_cb);
+       __get_slab_allocations(ami_memory_slab_alloc_cb);
+       __get_slab_stats(fh, ami_memory_slab_stats_cb);
 }
 
+/* Low memory handler */
 static void ami_memory_low_mem_handler(void *p)
 {
        if(low_mem_status == PURGE_STEP1) {
@@ -115,7 +148,7 @@ struct Interrupt *ami_memory_init(void)
        struct Interrupt *memhandler = malloc(sizeof(struct Interrupt));
        if(memhandler == NULL) return NULL; // we're screwed
 
-       memhandler->is_Node.ln_Pri = -100; // low down as will be slow
+       memhandler->is_Node.ln_Pri = -127; // low down as will be slow
        memhandler->is_Node.ln_Name = "NetSurf low memory handler";
        memhandler->is_Data = NULL;
        memhandler->is_Code = (APTR)&ami_memory_handler;
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index a87a3ea..7abf0a3 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -59,7 +59,7 @@ void *ami_memory_clear_alloc(size_t size, UBYTE value);
 
 /* clib2 slab allocator */
 #ifndef __amigaos4__
-void ami_memory_slab_dump(void);
+void ami_memory_slab_dump(BPTR fh);
 struct Interrupt *ami_memory_init(void);
 void ami_memory_fini(struct Interrupt *memhandler);
 #endif


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to