raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] raindrops 0.18.0 - real-time stats for preforking Rack servers
@ 2017-03-23  2:48  5% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-03-23  2:48 UTC (permalink / raw)
  To: ruby-talk, raindrops-public; +Cc: unicorn-public, Simon Eskildsen, Jeremy Evans

raindrops is a real-time stats toolkit to show statistics for Rack HTTP
servers.  It is designed for preforking servers such as unicorn, but
should support any Rack HTTP server on platforms supporting POSIX shared
memory.  It may also be used as a generic scoreboard for sharing atomic
counters across multiple processes.

* https://bogomips.org/raindrops/
* No subscription necessary, no HTML mail:
  raindrops-public@bogomips.org
* mail archives: https://bogomips.org/raindrops-public/
  http://ou63pmih66umazou.onion/raindrops-public/
  nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
  nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops
* git clone git://bogomips.org/raindrops.git
* https://bogomips.org/raindrops/NEWS.atom.xml
* Demo site: https://raindrops-demo.bogomips.org:8443/

Changes:

    raindrops 0.18.0
    
    The most notable feature of this release is the addition of
    FreeBSD and OpenBSD TCP_INFO support.  This includes the
    Raindrops::TCP for portably mapping TCP state names to
    platform-dependent numeric values:
    
      https://bogomips.org/raindrops/Raindrops.html#TCP
    
    Thanks to Jeremy Evans and Simon Eskildsen on the
    unicorn-public@bogomips.org mailing list for inspiring
    these changes to raindrops.
    
    There's also a few internal cleanups, and documentation
    improvements, including some fixes to the largely-forgotten
    Raindrops::Aggreage::PMQ class:
    
      https://bogomips.org/raindrops/Raindrops/Aggregate/PMQ.html
    
    20 changes since 0.17.0:
    
          test_inet_diag_socket: fix Fixnum deprecation warning
          TODO: add item for IPv6 breakage
          ext: fix documentation for C ext-defined classes
          TCP_Info: custom documentation for #get!
          TypedData C-API conversion
          test_watcher: disable test correctly when aggregate is missing
          tcp_info: support this struct under FreeBSD
          define Raindrops::TCP hash for TCP states
          linux_inet_diag: reduce stack usage and simplify
          avoid reading errno repeatedly
          aggregate/pmq: avoid false sharing of lock buffers
          aggregate/pmq: remove io-extra requirement
          aggregate/pmq: avoid File#stat allocation
          Merge remote-tracking branch 'origin/freebsd'
          Merge remote-tracking branch 'origin/aggregate-pmq'
          doc: remove private email support address
          doc: update location of TCP_INFO-related stuff
          build: avoid olddoc for building the RubyGem
          doc: document Raindrops::TCP hash
          aggregate/pmq: update version numbers for Ruby and Linux

^ permalink raw reply	[relevance 5%]

* [PATCH] TypedData C-API conversion
@ 2017-03-14 20:01  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-03-14 20:01 UTC (permalink / raw)
  To: raindrops-public

This provides some extra type safety if combined with other
C extensions, as well as allowing us to account for memory usage of
the HTTP parser in ObjectSpace.

This requires Ruby 1.9.3+ and has remained a stable API since
then.  This will become officially supported when Ruby 2.3.0 is
released later this month.

This API has only been documented in doc/extension.rdoc (formerly
README.EXT) in the Ruby source tree since April 2015, r50318
---
 ext/raindrops/linux_tcp_info.c | 16 +++++++++++++---
 ext/raindrops/raindrops.c      | 19 ++++++++++++++++---
 raindrops.gemspec              |  1 +
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/ext/raindrops/linux_tcp_info.c b/ext/raindrops/linux_tcp_info.c
index 4693e47..83001a5 100644
--- a/ext/raindrops/linux_tcp_info.c
+++ b/ext/raindrops/linux_tcp_info.c
@@ -46,12 +46,22 @@ TCPI_ATTR_READER(rcv_rtt)
 TCPI_ATTR_READER(rcv_space)
 TCPI_ATTR_READER(total_retrans)
 
+static size_t tcpi_memsize(const void *ptr)
+{
+	return sizeof(struct tcp_info);
+}
+
+static const rb_data_type_t tcpi_type = {
+	"tcp_info",
+	{ NULL, RUBY_TYPED_DEFAULT_FREE, tcpi_memsize, /* reserved */ },
+	/* parent, data, [ flags ] */
+};
+
 static VALUE alloc(VALUE klass)
 {
-	struct tcp_info *info = xmalloc(sizeof(struct tcp_info));
+	struct tcp_info *info;
 
-	/* Data_Make_Struct has an extra memset 0 which is so wasteful */
-	return Data_Wrap_Struct(klass, NULL, -1, info);
+	return TypedData_Make_Struct(klass, struct tcp_info, &tcpi_type, info);
 }
 
 /*
diff --git a/ext/raindrops/raindrops.c b/ext/raindrops/raindrops.c
index 65c16e7..390b8b8 100644
--- a/ext/raindrops/raindrops.c
+++ b/ext/raindrops/raindrops.c
@@ -38,7 +38,7 @@ struct raindrops {
 };
 
 /* called by GC */
-static void gcfree(void *ptr)
+static void rd_free(void *ptr)
 {
 	struct raindrops *r = ptr;
 
@@ -51,11 +51,24 @@ static void gcfree(void *ptr)
 	xfree(ptr);
 }
 
+static size_t rd_memsize(const void *ptr)
+{
+	const struct raindrops *r = ptr;
+
+	return r->drops == MAP_FAILED ? 0 : raindrop_size * r->capa;
+}
+
+static const rb_data_type_t rd_type = {
+	"raindrops",
+	{ NULL, rd_free, rd_memsize, /* reserved */ },
+	/* parent, data, [ flags ] */
+};
+
 /* automatically called at creation (before initialize) */
 static VALUE alloc(VALUE klass)
 {
 	struct raindrops *r;
-	VALUE rv = Data_Make_Struct(klass, struct raindrops, NULL, gcfree, r);
+	VALUE rv = TypedData_Make_Struct(klass, struct raindrops, &rd_type, r);
 
 	r->drops = MAP_FAILED;
 	return rv;
@@ -65,7 +78,7 @@ static struct raindrops *get(VALUE self)
 {
 	struct raindrops *r;
 
-	Data_Get_Struct(self, struct raindrops, r);
+	TypedData_Get_Struct(self, struct raindrops, &rd_type, r);
 
 	if (r->drops == MAP_FAILED)
 		rb_raise(rb_eStandardError, "invalid or freed Raindrops");
diff --git a/raindrops.gemspec b/raindrops.gemspec
index 356bff2..c00a6b5 100644
--- a/raindrops.gemspec
+++ b/raindrops.gemspec
@@ -18,6 +18,7 @@
   s.files = manifest
   s.homepage = Olddoc.config['rdoc_url']
   s.summary = summary
+  s.required_ruby_version = '>= 1.9.3'
   s.test_files = test_files
   s.add_development_dependency('aggregate', '~> 0.2')
   s.add_development_dependency('test-unit', '~> 3.0')
-- 
EW


^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2017-03-14 20:01  7% [PATCH] TypedData C-API conversion Eric Wong
2017-03-23  2:48  5% [ANN] raindrops 0.18.0 - real-time stats for preforking Rack servers Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/raindrops.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).