Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Inter Process Communication between C++ - C#

Inter Process Communication between C++ - C#

Scheduled Pinned Locked Moved C / C++ / MFC
performancecsharpc++question
4 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    ptr_Electron
    wrote on last edited by
    #1

    I am working on C++ project where performance is critical. there is no logging mechanism. I dont want to implement logging in the same project as it will hit performance. And hence I want to create A C# project while takes care of actually logging from C++ process I will push the Log strings to C# process to do Actually logging. I want to know which is the best IPC - Named pipes ? Memory Mapped files ? Socket Which should not hit the performance Could you please point me to some sample code/link which has the mechanism to Log from C++ to C# code please

    J L J 3 Replies Last reply
    0
    • P ptr_Electron

      I am working on C++ project where performance is critical. there is no logging mechanism. I dont want to implement logging in the same project as it will hit performance. And hence I want to create A C# project while takes care of actually logging from C++ process I will push the Log strings to C# process to do Actually logging. I want to know which is the best IPC - Named pipes ? Memory Mapped files ? Socket Which should not hit the performance Could you please point me to some sample code/link which has the mechanism to Log from C++ to C# code please

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      Logging will not be a performance issue if you do that in an own thread. That thread may be part of the application itself or another application. Using another application with IPC makes it more complicated and requires that the other application is running. So I would not use another application if there is no need for other communications besides logging. There might be even no need of using a thread when logging does not occur at high rates with large data. The log data has to be prepared anyway within the time critical thread. Using then a log file which stays open might be sufficient. If you are concerned about the file write times, use overlapped IO so that the writing is done by the system in the background (which is basically the same as suggested above: moving the operation to another thread). I know that the above is not what you asked for but I think it is helpful and you might find out that using IPC is not necessary. When maximum performance is a must-have, you have to use one of the above mentioned methods (own thread or overlapped IO) anyway even with IPC.

      1 Reply Last reply
      0
      • P ptr_Electron

        I am working on C++ project where performance is critical. there is no logging mechanism. I dont want to implement logging in the same project as it will hit performance. And hence I want to create A C# project while takes care of actually logging from C++ process I will push the Log strings to C# process to do Actually logging. I want to know which is the best IPC - Named pipes ? Memory Mapped files ? Socket Which should not hit the performance Could you please point me to some sample code/link which has the mechanism to Log from C++ to C# code please

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        ptr_Electron wrote:

        I want to know which is the best IPC - Named pipes ? Memory Mapped files ? Socket Which should not hit the performance

        On the Microsoft Windows platform the fastest possible logging is through Event Tracing for Windows (ETW)[^]. Logging with ETW so fast... graphics drivers can render at 150 FPS and perform logging at the same time without losing any framerate. What it basically does is write integers into a circular buffer all in RAM. There is nothing faster.

        ptr_Electron wrote:

        Could you please point me to some sample code/link which has the mechanism to Log from C++ to C# code please

        ETW logging msdn examples - Bing[^] Best Wishes, -David Delaune

        1 Reply Last reply
        0
        • P ptr_Electron

          I am working on C++ project where performance is critical. there is no logging mechanism. I dont want to implement logging in the same project as it will hit performance. And hence I want to create A C# project while takes care of actually logging from C++ process I will push the Log strings to C# process to do Actually logging. I want to know which is the best IPC - Named pipes ? Memory Mapped files ? Socket Which should not hit the performance Could you please point me to some sample code/link which has the mechanism to Log from C++ to C# code please

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          ptr_Electron wrote:

          I dont want to implement logging in the same project as it will hit performance.

          I was involved in a C++ project years ago. Unix based. Performance was a contractual requirement. The architect was sure that logging was a performance problem. So we removed logging. Absolute zero impact on performance. And that was back when spewing stuff to a console (stdio) could impact performance. If you have a performance problem then you need to address the requirements and design first before looking for problems in the implementation and technologies.

          ptr_Electron wrote:

          which has the mechanism to Log from C++ to C# code please

          Every logging library that I have seen for at least the past 10 years if not longer uses pluggable designs. Which means if the plugs that are already available do not meet your needs then you can create your own. However at least when I looked some already supported remote logging plugs.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups