Using IronRuby from Ruby (newbie)

Hello,

I’m working in an environment that’s very Ruby heavy and I’ve never used
ruby before. I need to be able to access Windows performance counters in
from a Windows service is written in native Ruby (not IronRuby). I’m
traditionally a C# and JAVA programmer.

I was wondering if it might be possible for Ruby to be able to access
the .Net System.Diagnostics performance counters via IronRuby. Of
course, if there’s a much simpler way I’m all ears.

I tried searching the forum and it seems my searching skills are not up
to par and apologize if this has been already answered. Thanks in
advance for any help.

Ameer.

You can access System.Diagnostics via IronRuby. However, you will have
to
use the IronRuby interpreter to run your native ruby code, which is
something I guess you are not willing to do (yet).

Maybe you’d better look for a gem or a Ruby library that simplifies
performance counter access…

Thanks,
Shay.


Shay F.
Author of IronRuby Unleashed
http://www.IronShay.com
Follow me: http://twitter.com/ironshay

To access the .NET framework from MRI (the Ruby implementation you are
currently using), your best bet is to use RubyCLR:
http://rubyforge.org/projects/rubyclr/. It is a native bridge between
Ruby and the CLR, using Ruby’s Win32OLE support to talk directly to the
CLR hosting APIs.

~js


From: [email protected]
[[email protected]] on behalf of Ameer D.
[[email protected]]
Sent: Monday, December 28, 2009 6:58 AM
To: [email protected]
Subject: [Ironruby-core] Using IronRuby from Ruby (newbie)

Hello,

I’m working in an environment that’s very Ruby heavy and I’ve never used
ruby before. I need to be able to access Windows performance counters in
from a Windows service is written in native Ruby (not IronRuby). I’m
traditionally a C# and JAVA programmer.

I was wondering if it might be possible for Ruby to be able to access
the .Net System.Diagnostics performance counters via IronRuby. Of
course, if there’s a much simpler way I’m all ears.

I tried searching the forum and it seems my searching skills are not up
to par and apologize if this has been already answered. Thanks in
advance for any help.

Ameer.

Posted via http://www.ruby-forum.com/.


Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Shay F. wrote:

You can access System.Diagnostics via IronRuby. However, you will have
to
use the IronRuby interpreter to run your native ruby code, which is
something I guess you are not willing to do (yet).

Maybe you’d better look for a gem or a Ruby library that simplifies
performance counter access…

Thanks,
Shay.


Shay F.
Author of IronRuby Unleashed
http://www.IronShay.com
Follow me: http://twitter.com/ironshay

Hi there Shay,

I’m not sure if I can run this existing ruby service (called collectd)
on IronRuby instead and I need to investigate that so your right about
the yet :). I’ll see if I can find a gem that can do what I’m looking
for. Thanks for the help.

Ameer.

Hi there Jimmy,

This looks very promising. Thanks very much for the pointer.

Ameer.

Jimmy S. wrote:

To access the .NET framework from MRI (the Ruby implementation you are
currently using), your best bet is to use RubyCLR:
http://rubyforge.org/projects/rubyclr/. It is a native bridge between
Ruby and the CLR, using Ruby’s Win32OLE support to talk directly to the
CLR hosting APIs.

~js

To high speed access the .NET framework from Ruby you can write own Ruby
extension on C++/CLI. So you can create custom wrapper for .NET class
and optimize them for your needs.

Yeah, RubyCLR is that.

Hi there Shay,

Using IronRuby to run the ruby code turned out to be easier than I
thought. I’m able to run the code on IronRuby and access the
System.Diagnostics namespace. Thanks very much for your help.

Ameer.

Shay F. wrote:

You can access System.Diagnostics via IronRuby. However, you will have
to
use the IronRuby interpreter to run your native ruby code, which is
something I guess you are not willing to do (yet).

Maybe you’d better look for a gem or a Ruby library that simplifies
performance counter access…

Thanks,
Shay.


Shay F.
Author of IronRuby Unleashed
http://www.IronShay.com
Follow me: http://twitter.com/ironshay