Results 1 to 9 of 9

Thread: any way to know how much bytes used for object serialization?

  1. #1
    mathgl is offline Registered User
    Name: gelin yan
    Organization: RoundTech Research Centre
    Project: large scale vehicle tracing system
    Join Date
    Jan 2010
    Location
    HongKong
    Posts
    23

    any way to know how much bytes used for object serialization?

    Hi All..

    I have a question about the size of object. As we know all objects before being sent to lan need to map to a sequence of bytes, Do you have any way to know how much bytes an object does occupy. I want to know this number for testing purpose....

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi,

    You can get the size of a request using protocol tracing by setting Ice.Trace.Protocol=1. Another option is to marshal the object into a byte sequence using the Ice streaming API and measure the size of the byte sequence.

    Cheers,
    Benoit.

  3. #3
    mathgl is offline Registered User
    Name: gelin yan
    Organization: RoundTech Research Centre
    Project: large scale vehicle tracing system
    Join Date
    Jan 2010
    Location
    HongKong
    Posts
    23
    Hi Benoit

    Thanks for your reply. After checking chapter 36.2, i used slice2cs with --stream to generate the .ice file again for serialization purpose. however when i checked the generated file i found a piece of codes like:

    public override void write__(Ice.OutputStream outS__)
    {
    Ice.MarshalException ex = new Ice.MarshalException();
    ex.reason = "type RoundTech::TTianHeInstantMessage was not generated with stream support";
    throw ex;
    }

    Could you please give me a guide how to let a type support stream?

    Thanks.

  4. #4
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi,

    Which Ice version do you use and on which platform? This should work. With Ice 3.4.0, you can try out the C# Ice/invoke demo for an example on how to marshall various Slice structures with the Ice streaming API.

    Cheers,
    Benoit.

  5. #5
    mathgl is offline Registered User
    Name: gelin yan
    Organization: RoundTech Research Centre
    Project: large scale vehicle tracing system
    Join Date
    Jan 2010
    Location
    HongKong
    Posts
    23
    Hi Benoit.

    Thanks for your reply. It was a typo actually. I use a macro command to invoke slice2cs. adding --stream didn't work at first until i fixed it.

    Now it works. Thanks again..

  6. #6
    mathgl is offline Registered User
    Name: gelin yan
    Organization: RoundTech Research Centre
    Project: large scale vehicle tracing system
    Join Date
    Jan 2010
    Location
    HongKong
    Posts
    23
    Quote Originally Posted by benoit View Post
    Hi,

    Which Ice version do you use and on which platform? This should work. With Ice 3.4.0, you can try out the C# Ice/invoke demo for an example on how to marshall various Slice structures with the Ice streaming API.

    Cheers,
    Benoit.
    Hi Benoit

    i want to know another thing about sequence type. In my ice file i have two definitions for sequence<string>. I show the code as follow:

    sequence<string> StringArrayType;

    ["clr:generic:List"]
    sequence<string> StringListType;

    this file works perfect without --stream. When i try to use the generated .cs file which is compiled with --stream. The compiler comlains there are no proper overload methods for StringSeqHelper outputstream/inputstream.

    If i drop down one of them, now it works again with --stream. Do you have any idea about that??

    Thanks..

  7. #7
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi

    I'm afraid you just found a bug in the Ice streaming API

    The generated C# code won't compile if it contains custom types such as ["clr:generic:List"] and if it's generated with --stream. We'll fix this, thanks for the report!

    Cheers,
    Benoit.

  8. #8
    mathgl is offline Registered User
    Name: gelin yan
    Organization: RoundTech Research Centre
    Project: large scale vehicle tracing system
    Join Date
    Jan 2010
    Location
    HongKong
    Posts
    23
    Hi Benoit

    I am using ICE 3.3.2 instead of 3.4, so probably this bug has been fixed....

  9. #9
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi,

    Actually, you're the first one to discover this bug so it isn't fixed in 3.4. It will be fixed in next version. Thanks again for the bug report.

    Cheers,
    Benoit.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How many bytes are really send?
    By AlexC in forum Help Center
    Replies: 3
    Last Post: 09-11-2010, 01:02 PM
  2. The structure and sequence of bytes
    By soff.dong in forum Help Center
    Replies: 1
    Last Post: 10-15-2008, 04:11 AM
  3. Is serialization zero copy?
    By Markus Bernhard in forum Help Center
    Replies: 4
    Last Post: 06-14-2006, 07:54 AM
  4. Object serialization in ICE
    By shantanu_k06 in forum Help Center
    Replies: 4
    Last Post: 02-17-2004, 01:00 PM
  5. The right way to transfer raw bytes with ICE
    By catalin in forum Help Center
    Replies: 1
    Last Post: 12-05-2003, 10:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •